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 out the dice values and the total like this:
Hit enter to roll 5,4,2,3,1 Total score: 15
3. Write a script that allows the user to roll five dice. They will have two turns. On the first turn, they roll all five dice and then set one aside, keeping that die's value. Then, they roll the remaining 4 dice. Their final score is the sum of all 5 dice (the one they saved and the 4 they rolled in their second turn).
Hit enter to roll You rolled Die 1: 1 Die 2: 5 Die 3: 3 Die 4: 6 Die 5: 1 Which die would you like to keep? 4 You saved die 4 with a value of 6 Hit enter to roll the remaining dice You rolled Die 1: 2 Die 2: 2 Die 3: 3 Die 4: 3 Your total score is 16
4. Write a script where the user rolls 4 dice on time. They win if at least two dice have the same value. They lose if all the dice have different values. Example:
Hit enter to roll You rolled 4,3,1,5 You Lose
5. Adapt exercise 4 so, instead of just rolling once, they user can play the game over and over.
1)
import random
i=1
while(i<=3):
strU = input("Hit enter to roll")
if(strU==''):
for x in range(5):
print(random.randint(1,6), end=' ')
print()
i=i+1
Output:

Explanation: As we need to roll thrice, make a while loop to run three times. Now in each roll we need five dice roll so generate random numbers between 1 and 6
2)
Program:
import random
sumNum = 0
strU = print("Hit enter to roll")
if(strU==''):
for x in range(5):
num = random.randint(1,6)
print(num, end=' ')
sumNum = sumNum + num
print()
print("Total score:",sumNum)
Output:

Explanation: Here we need to roll just once, five dice hence a for loop to run 5 times and generate 5 random numbers between 1 and 6. Also we need the total score hence add all the numbers generated in each roll.
3)
Program:
import random
die = []
value = []
sumNum = 0
strU = input("Hit enter to roll")
if(strU==''):
print("You rolled")
for x in range(5):
num = random.randint(1,6)
print("Die",x+1,":",num)
die.append(x)
value.append(num)
print()
dieNum = int(input("Which die would you like to keep: "))
print()
print("You saved die",dieNum,"with value of",value[dieNum-1])
strU = input("Hit to enter remaining roll")
if(strU==''):
print("You rolled")
for x in range(4):
num = random.randint(1,6)
print("Die",x + 1,":",num)
sumNum = sumNum + num
total = sumNum + value[dieNum-1]
print("Tota score:",total)
Output:

4)
Program:
import random
value = []
count
strU = input("Hit enter to roll")
if(strU==''):
print("You rolled")
for x in range(5):
num = random.randint(1,6)
print(num,end=' ')
value.append(num)
for x in range(5):
for y in range(5):
if(value[x]==value[y] and (x!=y)):
count = 1;
break;
print()
if(count == 1):
print("You win")
else:
print("You loose")
Output:

5)
Program:
import random
value = []
ch='a'
count=0
while(not(ch=='q'or ch=='Q')):
strU = input("Hit enter to roll")
if(strU==''):
print("You rolled")
for x in range(5):
num = random.randint(1,6)
print(num,end=' ')
value.append(num)
for x in range(5):
for y in range(5):
if(value[x]==value[y] and (x!=y)):
count = 1;
break;
print()
if(count == 1):
print("You win")
else:
print("You loose")
ch = input("Want to play again, q to quit: ")
Output:

Complete each problem separately and perform in python. 1. Create a script that will roll five...
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...
Write a script that prints a randomly generated integer between 1 and 6. When I run your script, it should print out only the number that would appear on the die like this: 5 and nothing else. Write a script that takes input for the number of sides on the die. An n sided die should return a random integer between 1 and n with the same stipulations as in Exercise 1. You should take n from the user as...
(CO 4 and 6) Create a program with a function named rollDice that will roll a dice as many times as the user asks and with a user specified number of sides. The function should return the roll of the die. The program should continue while the user presses Y. Sample output: How many times do you want to roll the die? 5 How many sides does the die have: 6 You rolled 1 You rolled 2 You rolled...
in C++ This assignment is to use your knowledge of Chap 1-5 to write a simulation program to estimate the winning chance of the Craps game. Craps is a popular dice game played in casinos. Here is how to play: Roll two dice. Each die has 6 faces representing values 1,2,3,4,5,and 6, respectively. Check the sum of 2 dice. If the sum is 2, 3, or 12 (called craps), you lose; if the sum is 7 or 11 (called natural),...
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.
This is in C++. The program needs to show the points as well.
The blue boxes show below are the output and it should look like
that. Thanks
(Game: craps) Craps is a popular dice game played in casinos. Write a program to play a variation of the game, as follows: Roll two dice. Each die has six faces representing values 1, 2, ..., and 6, respectively. Check the sum of the two dice. If the sum is 2, 3,...
1. You roll a pair of standard dice. Create the sample space for a single roll of the dice and use the sample space to compute the following probabilities. A. Create a sample space. B. P ( getting a 1 on the first die or getting a 5 on the second die) C. P (Sum of the dice = 10) D. P ( getting a 3 on the second die given that you got a 2 on the first die)...
WITHOUT FUNCTIONS. Could anyone help me solve this problem not using the function ? Thanks a lot. Pig Dice Game Pig is a simple two player dice game, played with one die. The first player to reach or surpass 50 is the winner. Each player takes a turn rolling the dice. They add to the pot with each roll, having to decide to roll again and increase the pot, or cash out. The risk being they could lose the amount...
In the game of Yahtzee®, players roll five dice simultaneously to try to make certain combinations. In a single turn, a player may roll up to three total times. On the first roll, the player rolls all five dice. On subsequent rolls, the player may choose to roll any number of the five dice ("keeping" dice by leaving selected unrolled dice on the table). If a player's first roll results in exactly three 5's (e.g., 2-5-5-3-5), what is the probability...
IN PYTHON Implement function yahtzee() that rolls (5) die (numbered 0 through 4) three times and prints the result after each roll. After each roll of the dice, the player is asked whether she wants to save one, or more, of the dice rolls. Here is an example usage: >>> yahtzee() You have 6, 3, 3, 5, and 4 What dice do you want to save? 1,2 You have 5, 3, 3, 1, and 6 What dice do you want...