It's Your Turn!
Imagine your company has organized a friendly inter-colleague Python competition! Your task: Simulate a roulette game using Python.
How does roulette work?
At a casino, the roulette wheel is composed of alternating red and black slots, each slot with its own number. Prior to spinning the wheel, a player place a bet on a roulette table. They start with a fixed amount of money and bets a small part of this amount at each spin.
The players objective is guess what number the roulette wheel will land on at each turn and, therefore, to win the most money. When the player has lost all their money, they are out of the game.
Simulate a roulette game in Python
The player bets on a single number between 0 and 49. While they choose their number, they also choose the amount of money to play.
The script generates a random number in this range (0 - 49), simulating the roulette. If the output number is the same than the number that was chosen (1/50 probability), then the player has won FIFTY times their bet!
If not, the player loses their bet and can try again in the next round.
If the user is running out of money, the script stops and displays that they have lost.
You will have some checkups to run:
When the player bets an amount of money, you have to check to ensure this corresponds with the amount of money the player has left. You also have to check that this amount is greater than 0. You will ask them as long as these conditions are not met.
When the player bets a number, the program has to check that the number is between 0 and 49.
You will provide your program in a Jupyter notebook format. Make sure that one loop statement has been used in addition to a conditional structure (if/else).