TOTAL = 100 MAX = 5 pile = TOTAL current_player = 1 def get_action(player): prompt = "Player "+str(player)+", how many stones do you take? (Enter a number from 1 - "+str(MAX)+".) " action = input(prompt) return action # was originally going to use this function to change the player, # but did not work with scope of variables I wanted # def next_player(): # if current_player == 1: # current_player = 2 # else: # current_player = 1 while pile > 0: action = get_action(current_player) while action > MAX or action <= 0 or pile - action < 0: print "That was not an appropriate response." action = get_action(current_player) pile = pile - action print "The number of stones remaining is "+str(pile)+"." # next_player() if current_player == 1 and pile > 0: current_player = 2 elif current_player == 2 and pile > 0: current_player = 1 else: print "Congratulations, player "+str(current_player)+", you are the winner!"