adam urbas wrote:
Thanks for the clarification, but I'm still a tad confused.  I'm not sure when to indent. 
The following keywords introduce a "suite" (1 or more statements) that are "controlled" by the keyword. Those statements must be indented further than the keyword. What more can anyone say? If this is not clear please explain at which point you lose clarity.
 if
 elif
 else
 while
 for
 try
 except
 finally
 with
 def
 class

Example:
 a = 0
 while a < 4: # statement that introduces a suite
    print a   # another statement in the while suite
    if a == 2:
# statement in the while that introduces another suite
        print "We hit 2" # statement in the if suite
    a += 1    # statement in the while suite; if suite has ended
 
print "done" # while suite has ended

This results in output:
0
1
2
We hit 2
3

-- 
Bob Gailer
510-978-4454

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to