trying to make a simple program help please :)

Irmen de Jong irmen.NOSPAM at xs4all.nl
Fri Oct 14 14:30:02 EDT 2016


On 14-10-2016 20:11, LongHairLuke wrote:
> Hi, l l am trying to make a simple guess program. This is my script: 
> 
> def main():
>     print ("Guess a letter between a and e")
>     randomNumber = b
>     
>     userGuess = input("Your guess: ")
> 
> if userGuess == randomNumber:
>      print("You got it")
> else:
>      print ("That's not it")
>     
> main()
> 
> 
> When l run the program l get error: userGuess is not defined, but l defined userGuess at line 5. I don't get it someone plese help :) 
> 
> Lukas Alberts 
> 

The indentation of the if/else statement in your program is off.  Fix it by properly
indenting the if-else to be at the same indentation level as the other lines that should
be part of the main() function.


Irmen




More information about the Python-list mailing list