Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Develop a python script that will test if we can guess the value of two simulated dice being rolled. The basic process ( detailed process
Develop a python script that will test if we can guess the value of two simulated dice being rolled.
The basic process detailed process below for us creating the game will involve us first recording the
values that we guess the two rolled dice will sum up to We will store these in a variable, which is
essentially a container for our information. We will then simulate two dice rolls by generating a random
number between and and storing these two random numbers in two difference variables. Last, we
will run a series of tests to see if we guessed the sum of the dice and print a congratulatory statement if
it was properly guessed.
Steps:
Create a variable for yourself by typing your name. Set the variable to the guess by typing
guessnumber after the name
Test to make sure this is working. Create a print statement to print the values of our new name
variables. We can do this by typing the command print followed by what we want to print the
variables
Now that we have recorded our guesses, we need to generate the two random numbers from
the roll of the two dice. To do this, you should use random.ranint Specify the values as the
possible values and assign this random number to another variable. Repeat for the second dice.
Note, this uses the source code from the
random.py library so we need to import this library se
we can use it To do this, type import random in the first line of your code.
Last, we will use a series of conditional statements to test if the sum of the two dice equal each
guess and then if it does, print "congratulations team member name"
Click RUN
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started