def deposit():
while True:
amount = input("What would you like to deposit? $")
if amount.isdigit():
amount = int(amount)
if amount > 0:
break
else:
print("Amount must be greater than 0.")
else:
print("Please enter a number.")
return amount
- This part of the code tells the user to deposit amount that is not 0 or under.
def get_number_of_lines():
while True:
lines = input("Enter the number of lines to bet on (1-" + str(MAX_LINES) + ")? ")
if lines.isdigit():
lines = int(lines)
if 1 <= lines <= MAX_LINES:
break
else:
print("Enter a valid number of lines.")
else:
print("Please enter a number.")
return lines
def main():
balance = deposit()
lines = get_number_of_lines()
print(balance, lines)
main()
- This part of the code tells the user to Enter the number of lines to bet on and makes sure to Enter a valid number of lines.
def get_bet():
while True:
amount = input("What would you like to bet on each line? $")
if amount.isdigit():
amount = int(amount)
if MIN_BET <= amount <= MAX_BET:
break
else:
print(f"Amount must be between ${MIN_BET} - ${MAX_BET}.")
else:
print("Please enter a number.")
return amount
def main():
balance = deposit()
lines = get_number_of_lines()
bet = get_bet()
total_bet = bet * lines
print(f"You are betting ${bet} on {lines} lines. Total bet is equal to: ${total_bet}")
main()
- This part of the code tells the user how much does the user would like to bet on each line. And make sure the user bet a amount that is Enter a valid number of lines.