Project Error

I am working on the Number Guess project, and I keep getting the attached error. The only thing I can see is line 6, where the raw_input should be highlighed red rather than white (as per the Get Unstuck Video), but I can’t tell why its not in red.


I believe the problem is that the if … else … statement is not indented.
It should be:

def roll_dice():
    #Code Above
    if guess > max_val
    #Code Below

The error was correct in saying that ‘guess’ is not defined.
The missing indent meant that the if statement was executed after the function was defined. As ‘guess’ is a local variable, Python doesn’t know what to use within the if statement.

Hope that helps!


Thank you, that has worked!

1 Like