Question

In python 3, Write a program in Python that simulates the roll of two dice. The...

In python 3,

Write a program in Python that simulates the roll of two dice.

The first die is a 6-sided die. The second die is an 8-sided die.

Generate a random number for a die and store it in variable number1.

Generate a random number for a die and store it in variable number2.

Note: Submit your code with the print("You rolled two dice:", number1, "and", number2) statement.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

import random;
choice="yes"
while choice=="yes" or choice=="y": # users choice of playing game
print(" Rolling the two dices....")
number1=random.randint(1,6) # implementing 6 sided dice using radnom function
number2=random.randint(1,8) # implementing 8 sided dice using radnom function
print(" you rolled two dices:",number1,"and",number2)
choice=input(" Roll the dices again? yes or no ")
  
Screen shots:

Output:

Add a comment
Know the answer?
Add Answer to:
In python 3, Write a program in Python that simulates the roll of two dice. The...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • please do it in C++ Write a program that simulates the rolling of two dice. The...

    please do it in C++ Write a program that simulates the rolling of two dice. The program should use rand to roll the first die and should use rand again to roll the second die. The sum of the two values should then be calculated. [Note: Each die can show an integer value from 1 to 6, so the sum of the two values will vary from 2 to 12, with 7 being the most frequent sum and 2and 12...

  • PYTHON: Dice Rolling Write a script that takes input for the number of dice to roll...

    PYTHON: Dice Rolling Write a script that takes input for the number of dice to roll and for the number of sides for the dice. Roll that many n-sided dice and store the values an array. Take the number of sides of the dice and the number of dice as typed inputs from the user. Output should be a comma separated list of the die numbers with no spaces like this: 6,4,1,3,1 Write a script that will simulate the roll...

  • (MATLAB) Write a program that simulates a dice roll by picking a random number from 1-6...

    (MATLAB) Write a program that simulates a dice roll by picking a random number from 1-6 and then picking a second random number from 1-6.    How many times do you get two 1’s. What many times do you get two 1’s if you simulate 10,000 rolls of a pair of dice?

  • Write a java program that simulates the rolling of four dice. The program should use random...

    Write a java program that simulates the rolling of four dice. The program should use random number generator to roll dice. The sum of the four values should then be calculated. Note that each die can show an integer value from 1 to 6, so the sum of the four values will vary from 4 to 24, with 14 being the most frequent sum and 4 and 24 being the least frequent sums. Your program should roll the dice 12,960...

  • Please i need helpe with this JAVA code. Write a Java program simulates the dice game...

    Please i need helpe with this JAVA code. Write a Java program simulates the dice game called GAMECrap. For this project, assume that the game is being played between two players, and that the rules are as follows: Problem Statement One of the players goes first. That player announces the size of the bet, and rolls the dice. If the player rolls a 7 or 11, it is called a natural. The player who rolled the dice wins. 2, 3...

  • Complete each problem separately and perform in python. 1. Create a script that will roll five...

    Complete each problem separately and perform in python. 1. Create a script that will roll five dice and print out their values. Allow the user to roll the dice three times. Prompt them to hit enter to roll. Ex: Hit enter to roll 1,4,3,6,6 Hit enter to roll 3,5,1,2,1 Hit enter to roll 4,3,4,2,6 2. Write a script that will roll five dice (just one time). The user's score will be the sum of the values on the dice. Print...

  • How to write python code that is a dice rolling function that generates random numbers. The...

    How to write python code that is a dice rolling function that generates random numbers. The dice rolling function takes two arguments: the first argument is the number of sides on the dice and the second argument is the number of dice. The function returns the sum of the random dice rolls. For example, if I call roll dice(6,2) it might return 7, which is the sum of randomly chosen numbers 4 and 3. It somewhere along the lines of:...

  • Write a Python (version 3.5.2) program that simulates how often certain hands appear in Yahtzee. In...

    Write a Python (version 3.5.2) program that simulates how often certain hands appear in Yahtzee. In Yahtzee, you roll five dice and then use those dice to make certain combinations. For example, the Yahtzee combination is formed by all five dice having the same value. A large straight occurs when all of the dice are in consecutive order (e.g., 1,2,3,4,5 or 2,3,4,5,6). If you haven’t played Yahtzee, you can find out more from various online sources such as Wikipedia. Once...

  • Create a Dice Game: PYTHON This game is between two people. They will roll a pair...

    Create a Dice Game: PYTHON This game is between two people. They will roll a pair of dice each 10 times. Each roll will be added to a total, and after 10 rolls the player with the highest total will be the Winner! You will use the RANDOM class RANDRANGE to create a random number from 1 to 6. You'll need a function for "rollDice" to roll a pair of dice and return a total of the dice. You must...

  • question 2 in C programming please PE-05b-01 (Six-sider) write a counter-controlled program that prompts the user...

    question 2 in C programming please PE-05b-01 (Six-sider) write a counter-controlled program that prompts the user to enter the number of times n to roll a six-sided die. The program should print to the screen the iteration of the loop and result for each roll 1 ) How many times would you like to roll? 3 roll 6 6 5 1 2) PE 05b 02 (Flash Cards) Write a counter-controlled program that creates addition problems for an elementary kid to...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT