If the player types in any out of range or invalid values, I want it to loop back to ask him to place his bet again.
I can get this half-way working when I wrap raw_input with int().
However, if say the player accidentally typed a letter or just hit enter without typing anything, it would throw an error, thus stopping the game/script.
So if a player does make a mistake like that, I need it to loop back to "Place your bet" again instead of throwing an error and crashing the script.
def betAmount():
if number_of_hands == 1:
if chip_count_player1 > 0:
global chips_bet
chips_bet = raw_input("Place your bet!")
if chips_bet in range(0, chip_count_player1 + 1):
print "Your bet is within range"
else:
print "NOT IN RANGE"
betAmount()