I am following along the Dice guessing game project here (https://www.codecademy.com/courses/learn-python/projects/number-guess) and have encountered an issue when attempting to test numbers that should trigger a “too high” warning. I get no output when entering in a value higher than max_val. It doesn’t seem to evaluate my if loop whatsoever. I have entered in print statements to check values of variables and they all seem to report the right numbers up to the if statement.
Here is my code:
from random import randint from time import sleep def get_user_guess(): user_guess = int(raw_input("Guess the value of the two dice: ")) return user_guess def roll_dice(number_of_sides): first_roll = randint(1,number_of_sides) print first_roll second_roll = randint(1,number_of_sides) print second_roll max_val = 2 * number_of_sides print "The maximum value is %d" % max_val guess = get_user_guess() print guess, max_val if guess > max_val: return "Guess too high" roll_dice(6)
If you are familiar with this project from CodeAcademy, you will notice it is not near done, I was instructed to test my code at this point and am stuck on this essential issue. thanks for any pointers you may have.