Question: FCOMP 1516 Python project Lab 3 Add the following functions to the file lab3.py Function is_even (), the function takes an integer number as a
FCOMP 1516 Python project Lab 3
Add the following functions to the file lab3.py Function is_even (), the function takes an integer number as a parameter and returns True if the number is even and False if the number is odd. COMP 1516 SESSION #3 LAB Function get_pocket_colour (), the function accepts an integer between 0 through 36 inclusive and return the colour of the pocket with the given number. The possible colours are green, red or black. The colours of the pockets are as follows: o Pocket O is green. o For pockets 1 through 10 inclusive, the odd-numbered pockets are red and the even-numbered pockets are black. o For pockets 11 through 18 inclusive, the odd-numbered pockets are black and the even-numbered pockets are red. o For pockets 19 through 28 inclusive, the odd-numbered pockets are red and the even-numbered pockets are black. o For pockets 29 through 36 inclusive, the odd-numbered pockets are black and the even-numbered pockets are red. Function play_roulette (), on a roulette wheel, the pockets are numbered from 0 to 36. The function will ask the user to enter a pocket number and the amount of a bet. The function displays whether the pocket is green, red, or black and weather the user wins or loses. o If the number is the colour is green and the user will not win or lose. o If the number is even and the colour is black the user wins 50% of the bet so if the bet is 100 the user will get 150. o If the number is even and the colour is red the user wins 100% of the bet amount so if the bet is 100 the user gets 200. o If the number is odd and the colour is black the user loses the bet. o If the number is odd and the colour is red the user wins 50% of the bet. A message of the prize amount or loss will be displayed The program should display an error message if the user enters a number that is outside the range of O through 36. The user will be prompted if he/she wants to play another round. The game will keep going until the user does not answer yes. Hint: use function is_even()and function get_pocket-colour. Add the function calls play_roulette() to the main function. COMP 1516 SESSION #3 LAB Sample output of function play_roulette() running play roulette enter a pocket number between 0 and 36 inclusive: enter your bet amount 108 you neither win nor lose you have 100.0 $ you won you have 100.0 $ do you want to paly again? type "yes" to continue, anything else to stop: yes enter a pocket number between 0 and 36 inclusive: 10 enter your bet amount 180 you won you have 150.0 $ do you want to paly again? type "yes" to continue, anything else to stop: yes enter a pocket number between 0 and 36 inclusive: 18 enter your bet amount 50 you won you have 100.0 $ do you want to paly again? type "yes" to continue, anything else to stop: no Process finished with exit code O
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
