Question: Problem Statement:Create a Python program to simulate a 3 - reel slot machine. User - Defined Function spin _ reel: Implement a function named spin

Problem Statement:Create a Python program to simulate a 3-reel slot machine. User-Defined Function spin_reel: Implement a function named spin_reel() that takes no parameters and returns a random integer between 1 and 5. This integer represents the result of a spin on a single slot reel. User-defined Function play_slot_machine: Implement a function play_slot_machine(num_spins, player_money) that takes the number of spins enterd by the user and the users money amount and simulates the playing of the requested number of spins.o Slot Machine Logic: The slot machine should have three reels, each spinning independently. Use the spin_reel() function to determine the result for each wheel. If all three wheels show the same number, the player wins a jackpot ($50) and that should be added to their money. Otherwise, the player loses. At the end, display the number of wins, number of losses, and the players money total. User Interface:o The user starts off with $100o Each spin costs $2o Allow the user to input the number of spins they want to play and subtract the correct amount (2 x the number of spins) from their money.o Call the play_slot_machine function Here is the basic program algorithm your solution should follow:1. spin_slot function: Generates a random integer between 1 and 5 to simulate a spin.2. play_slot_machine function:o Takes the desired number of spins and the players money amount as input.o Keeps track of wins and losses.o For each spin, it: Spins each wheel using spin_slot(). Checks if all wheels match for a win. Updates win/loss counters. Prints the final results.3. Main program: Prompts the user for the number of spins. Calls the play_slot_machine function to simulate the game. What to submit: A .zip file

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!