Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The program will simulate spinning a wheel that has been numbered 1 through 16. Not only is the wheel numbered, but it also has
The program will simulate spinning a wheel that has been numbered 1 through 16. Not only is the wheel numbered, but it also has colors and a designated jackpot value. Each time the wheel spun, the number is output along with either the color or label for the number: The number 16 on the wheel indicates a Jackpot. When the program starts, it will ask the user how many time to spin the wheel. The user must enter a number between 4 and 10. Then the program will simulate spinning the wheel that number of times. Sample Output: How many times do you want to spin the wheel? 3. Enter a number between 4 and 10. How many times do you want to spin the wheel? 8 Spin 1: 6 ==> Green Spin 2: 13 ==> Yellow Spin 3: 10 ==> Yellow Spin 4: 16 ==> JACKPOT! Spin 5: 3 ==> Green Spin 6: 2 ==> Red Spin 7: 14 ==> Red Spin 8: 11 ==> Red Thanks for playing! Otherwise, it is represented by a color: o If the number divides by 3 exactly, the color is Green. o If the number divided by 3 has a remainder of 1, the color is Yellow. If the number divided by 3 has a remainder of 2, the color is Red. o The program should have TWO functions: main - This function is the main routine. It should do the following: Ask the user how many times they want to spin the whell, If the user enters a number less than 4 or greater than 10, the program should continue to ask the user for a valid number between 4 and 10. o Remember you can use a while loop to do input validation. Once the program has a valid number from the user, it should use that number as an argument when calling the spin wheel function. . Rin wheel-This function has one parameter, spins, which is the number of times to spin the wheel. . . . Use a for loop to spin the wheel the number of times specified. Use the randint function from the random module to get a random digit between 1 and 16 inclusive. Print the number of the loop iteration and the spin value as indicated in the Sample Output. o The number of the loop iteration should start with 1. o The spin value should include the number and either the color of the number or "JACKPOT!" in the case of number 16. After the for loop is complete, print a message thanking the user for playing.
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