newbie: Syntax error
Kartic
kartic.krishnamurthy at gmail.com
Fri Feb 4 13:54:19 EST 2005
Chad,
The usage is like this:
- if <cond1>:
- <block 1>
- elif <cond2>:
- <block 2>
- else:
- <block 3>
So, your code should be:
if tries == 1:
....
elif tries == 2:
....
(You have 'else' followed by a condition...hence a syntax error. else
is what it means - "if no other condition is satisfied". You should use
'elif' for subsequent conditions after 'if'.)
Thanks,
-Kartic
More information about the Python-list
mailing list