Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

16.18 Lab 7B: Dice game Overview You are going to use what you learned about random number generation and simulate rolling a die for two

image text in transcribed
image text in transcribed
16.18 Lab 7B: Dice game Overview You are going to use what you learned about random number generation and simulate rolling a die for two players. Then depending on the result, print out a message indicating who won. Objectives The objectives of this lab are to continue to use what you have learned about generating random numbers, and to be able to take action based on a result of the program. You will first prompt for each player's name. The prompts should be "Enter name for player 1:' and 'Enter name for player 2. Once you have each player's name, roll the dice for each player. We will assume a standard 6 sided die for this game. When you've rolled the dice, report the roll for each player, and the 'winner" (the one who rolled the higher number) on two lines as follows: For example, if the player names were 'Alice' and 'Bob', and the dice rolls were 5 and 3, you would print Alice rolled a 5 and Bob rolled a 3 Alice wins! In the case of a tie, you would print Alice rolled a 6 and Bob rolled a It's a tie! You should not set any random seed for this program so your results will be more realistically random Run your program several times to make sure you can test the first player winning, the second player winning, and a tie. It may take many attempts to generate all the possibilities ACTIVITY 16.18.1: Lab 7B: Dice game 0/20 Alice rolled a 6 and Bob rolled a 6 It's a tie! You should not set any random seed for this program so your results will be more realistically random. Run your program several times to make sure you can test the first player winning, the second player winning, and a tie. It may take many attempts to generate all the possibilities LAB ACTIVITY 16.18.1: Lab 7B: Dice game 0/20 main.py Load default template... insert your code here" Develop mode Submit mode Run your program as often as you'd like, before submitting for grading. Below, type any needed input values in the first box, then click Run program and observe the program's output in the second box

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DB2 9 For Linux UNIX And Windows Advanced Database Administration Certification Certification Study Guide

Authors: Roger E. Sanders, Dwaine R Snow

1st Edition

1583470808, 978-1583470800

More Books

Students also viewed these Databases questions

Question

3. Describe the communicative power of group affiliations

Answered: 1 week ago