Stuck on project 4 already had to take all the 'return' out just so it would run, but now I'm getting :
'NameError: name 'max_val' is not defined'
for line 17 and at this point, I literally copied and pasted from the hint. (I know, it's not learning, but it's shipping)
I've created the variable on line 13, so I'm not sure what else I could do.
### this is a game where the computer is going to 'roll' dice and the users have to guess the number### from random import randint from time import sleep def get_user_guess(): user_guess = int(raw_input("Guess a number: ")) return user_guess def roll_dice(number_of_sides): first_roll = randint(1, number_of_sides) second_roll = randint(1, number_of_sides) max_val = number_of_sides * 2 print "The maximum value you can guess is: " + str(max_val) sleep(1) user_guess = get_user_guess() if user_guess > max_val : ###this ^^^ is where I keep getting the error### print "That answer is no dice because it's more than the possible number." else: print "Rolling ...(the dice)...." sleep(2) print "The first roll value is: %d" % first_roll sleep(1) print "The second dice says: %d" % second_roll sleep(1) total_roll= first_roll + second_roll print "The result..." sleep(1) if user_guess > total_roll: print "Winner, winner, chicken dinner! You win...this time." else: print "No dice. Sorry!" roll_dice(6)