Conditionals

elif statement

     if a == '+':
         op = PLUS
     elif a == '-':
         op = MINUS
     elif a == '*':
         op = MULTIPLY
     else:
         op = UNKNOWN
  • Note: There is no switch statement.

Boolean expressions: and, or, not

     if b >= a and b <= c:
         print "b is between a and c"
     if not (b < a or b > c):
         print "b is still between a and c"
<<< O'Reilly OSCON 2000, Advanced Python Programming, Slide 9
July 17, 2000, beazley@cs.uchicago.edu
>>>