Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def input_bet(bet, money):
- #Ask for bet
- bet_check = raw_input("Bet? (0 to quit, Enter to stay at $" + str(bet) + ") ")
- try:
- int(bet_check)
- #Quit game if player inputs 0
- if bet_check == 0:
- print("Player has quit")
- quit()
- #Check that bet is not negative
- elif bet_check < 0:
- try:
- bet_check >= 0
- except ValueError:
- print("You cannot bet a negative amount")
- #Check that bet is less than amount in account
- else:
- try:
- bet_check <= money
- except ValueError:
- print("You cannot bet more than $" + money)
- except ValueError:
- try:
- float(bet_check)
- try:
- bet_check % 1 == 0:
- except TypeError:
- print("You must bet a whole number")
- except ValueError:
- try:
- str(bet_check)
- if bet_check == "":
- if bet < money:
- bet_check = bet
- elif bet > money:
- try:
- bet <= money
- except ValueError:
- print("You cannot bet more than $" + money)
- else:
- try:
- bet_check == ""
- except ValueError:
- print("You must type a number")
- bet = bet_check
- return bet
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement