Trying to complete the number guess portion of learn Python and repeatedly getting an error on step 17. The error is “max_val” is not defined when I try to guess a number higher than the limitations I have programmed. Copied the code below. Any help is greatly appreciated.
"This program rolls a pair of dice and compares the outcome to your guess." from random import randint from time import sleep def get_user_guess(): guess=int(raw_input("Guess a number")) return 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 number of sides is %d" % max_val guess=get_user_guess() if guess > max_val: print "Guess is invalid" roll_dice(6)