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 transcribedimage 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 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. 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.. 1 " insert your code here" WN

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_2

Step: 3

blur-text-image_3

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

Database Principles Programming And Performance

Authors: Patrick O'Neil, Elizabeth O'Neil

2nd Edition

1558605800, 978-1558605800

More Books

Students also viewed these Databases questions

Question

Explain Coulomb's law with an example

Answered: 1 week ago

Question

What is operating system?

Answered: 1 week ago

Question

What is Ohm's law and also tell about Snell's law?

Answered: 1 week ago

Question

2. Identify issues/causes for the apparent conflict.

Answered: 1 week ago