Question
Write a program that simulates rolling dice. You are playing against the computer. The computer will roll the dice by randomly generating a number between
Write a program that simulates rolling dice. You are playing against the computer. The computer will roll the dice by randomly generating a number between 1 and 6 inclusive. You will then be asked if you want to roll the dice (Do you want to roll the dice?). If you respond with Y or y, the dice is rolled by randomly generating a number between 1 and 6. Print the number generated (I rolled: number). If your roll matches the initial computer roll, then display I rolled:numberthen I WIN!on a new line and quit the program. If the roll does not match, you will be asked to roll again (Do you want to roll the dice?). If you respond with N or n, the game ends. Responding with something other than Y or y or N or n simply re-prompts the user for another roll. This program will be graded manually. There are no pre-defined test cases.
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