[Tutor] IF statements
WM
WFERGUSON1 at SOCAL.RR.COM
Mon Oct 6 04:51:53 CEST 2008
I used to do Basic and enjoyed it. Someone said Python was a vastly
better language than Visual Basic, which I considered playing with. So
I sought to give it a go but struck a sticking point very early.
I am now going through the Python tutorial. All went well until I came
to IF. The code below was not written by me. It is a copy/paste job
from the tutor. I do not have any idea what is going wrong.
IDLE 2.6
>>>
>>>
>>> x = int(raw_input("Please enter an integer: "))
Please enter an integer: 42
>>> if x < 0:
... x = 0
... print 'Negative changed to zero'
... elif x == 0:
... print 'Zero'
... elif x == 1:
... print 'Single'
... else:
... print 'More'
...
More
12
SyntaxError: invalid syntax
>>>
More information about the Tutor
mailing list