I'm a newbie to Python and currently learning Control Flow commands like if, else, etc.
The if statement is working all fine, but when I write else or elif commands, the interpreter gives me a syntax error. I'm using Python 3.2.1 and the problem is arising in both its native interpreter and IDLE.
I'm following as it is given in the book 'A Byte Of Python' . As you can see, elif and else are giving Invalid Syntax.
>> number=23
>> guess = input('Enter a number : ')
>> if guess == number:
>> print('Congratulations! You guessed it.')
>> elif guess < number:
**( It is giving me 'Invalid Syntax')**
>> else:
**( It is also giving me 'Invalid syntax')**
Why is this happening? I'm getting the problem in both IDLE and the interactive python. I hope the syntax is right.


passto it.str()type and number is an instance of theint()type. When comparing the two with anything other than the equality or inequality operator may or may not be interpreted as a type-unsafe operation, based on your Python version.