Question
On a roulette wheel, the pockets are numbered from 0 to 36. The colors of the pockets are as follows: Pocket 0 is green. For
On a roulette wheel, the pockets are numbered from 0 to 36. The colors of the pockets are as follows:
Pocket 0 is green.
For pockets 1 through 10, the odd-numbered pockets are red and the evennumbered pockets are black.
For pockets 11 through 18, the odd-numbered pockets are black and the evennumbered pockets are red.
For pockets 19 through 28, the odd-numbered pockets are red and the evennumbered pockets are black.
For pockets 29 through 36, the odd-numbered pockets are black and the evennumbered pockets are red.
Write a function HW3_p1_roulette() that asks the user to enter a pocket number and displays whether the pocket is green, red, or black. The function should display an error message if the user enters a number that is outside the range of 0 through 36.
Test your function by matching the expected output for the given inputs exactly. You can try the following test inputs (the instructor may run additional and/or different scenarios to test your code):
Test input 0, 6, 16, 26, 36, 37
>>> for i in [0, 6, 16, 26, 36, 37]: ...
HW3_p1_roulette()
Green
Red
Black
Red
Black
Error: Invalid input
Hint: Use if-elif-else and nested if-else statements to make the proper selection decision.
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