Question: Please Code this in python 1.The player starts with $100 and bets a whole dollar amount (i.e., an integer) each time they pull the lever.

Please Code this in python

1.The player starts with $100 and bets a whole dollar amount (i.e., an integer) each time they pull the lever.

  • Ask the user to enter their bet amount, then the lever gets pulled when they hit enter.
  • If they enter an invalid entry, ask them to try entering something again until they provide a valid entry.

2.When they pull the lever, the three reels spin and the results of each reel are shown to the user.

3.Each reel can be one of four things: skull, bell, horseshoe, or a 7. Hint: include these in a list.

  • If they get three bells, they win 2x their bet.
  • If they get three horseshoes, they win 4x their bet.
  • If they get three 7s, they win 10x their bet.
  • Bonus: If they get two bells, two horseshoes, or two 7s and no skulls, they win the bet (i.e., they get paid the amount that they bet).
  • If none of the above happens, they lose the value of the bet.

4.After each result, tell the user what they won or lost and what their current bankroll is (i.e., how much money they have left).

5.The user keeps playing (making a bet, pulling the lever) until either (a) they run out of money or (b) they enter a q to quit (should be case-insensitive).

HINTS

To enable the generation of "random" numbers, at the top of your program include this (you only need to include this one time):

import random # This module allows us to generate "random" numbers.

Then, to generate a random number, do something like the following (where "result" is just a variable name). You can change the 0 and 5 to create any desired range of possible values.

result = random.randint(0,5) # Provides random value between 0 and 5.

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 Databases Questions!