problem with "elif"
Matthew Dixon Cowles
matt at mondoinfo.com
Sat Nov 24 15:35:18 EST 2001
On Sat, 24 Nov 2001 21:26:43 +0100, Pjotr <pjotr at poland.com> wrote:
Dear Pjotr,
>Hello!
Hi!
>I started learning Python, using Python 2.1.1 and Ivan Laningham's
>book "Teach yourself Python...".
Cool. Welcome to Python!
>I have a problem with instruction "elif":
>>>> y = 1900
>>>> leap = "no"
>>>> if y % 400 == 0 :
> leap = "yes"
> elif y % 100 == 0 :
>IndentationError: unindent does not match any outer indentation level
>(line 3)
>What's up? This example is from Laningham's book and everything
>should be OK. Please help me!
elifs need to line up with the corresponding if so if you move your
elif left by three spaces, you should be fine. That's a convenient way
of doing things because it means that long sequences of elifs don't
end up marching right across the screen until even short lines wrap.
Regards,
Matt
More information about the Python-list
mailing list