Question
Write a program that play a simple dice game between the computer and the user. When the program runs, a loop should repeat 10 times.
Write a program that play a simple dice game between the computer and the user. When the program runs, a loop should repeat 10 times. Each iteraton of the loop shoud do the following:
1. Generate a random integer in the range of 1 through 6. This is the value of the computer's die.
2. Generate another random integer in the range of 1 through 6. This is the value of the user's die.
3. Each time, the die with the highest value wins. (In case of a tie, there is no winner for that particular roll of the dice.)
As the loop iterates, the program should keep count of the number of times the computer wins, ant the number of times that the user wins. After the loop perfomrs all of its iterations, the program should display who was the grand winner, the computer, or it was a tie.
You can use a while/for loop in your program.
Sample output: Round1: You win!
Round2: It was a tie!
Round3: The computer wins!
Round4:It was a tie!
Round5: The computer wins!
Round6: The computer wins!
Round7:You win!
Round8:You win!
Round9: It was a tie!
Round10: You win!
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