On Tue, Aug 10, 2010 at 9:11 PM, rara avis <fried.sigm...@gmail.com> wrote:

> Hi: I am trying to teach myself Python, and am stuck at the indentation
> with the elif statement.
> This is what I am trying to type:
>
> x=3
> if x==0:
>
>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>
x = 3
if x == 0:
  print 'x == 0'
elif x != 0:
  print 'x != 0'

x != 0
-- 
The block of code under 'if x...' is indented.  Most people use 4 spaces.
You can use any number of spaces, but you need to be consistant
The elif indentation must match its matching if statement.  In this case
neither are indented
The block which executes under the elif is indented to the same level as
that under the original if


Joel Goldstick
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to