Question
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
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.
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