On Tue, Jan 6, 2009 at 20:12, WM. <[email protected]> wrote:
>>>> i = 5
>>>> j = 7
>>>> if i <= j:
> print 'nudge, nudge'
> else:
>
> File "<pyshell#8>", line 3
> else:
> ^
> IndentationError: unexpected indent
Python uses indentation to seperate code blocks and will throw an
error if it finds inconsistancies. In your example else is indented
while it sould not be.
There is also a second error in the code. If you have an else you need
to do something in the else block. Below is a working version.
>>> i = 5
>>> j = 7
>>> if i <= j:
print 'Nudge nudge'
else:
print 'Icecream'
Nudge nudge
I know it looks weird in idle as the original if i <= j is to the
right of the else but both are *not* indented.
Greets
Sander
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor