Title: Layout 4
Course: CPS 120: Introduction to Computer Science ~ Master (Aug/2015) OLD > Section: Learning Units

✓ Layout 4 – test whether or not to execute one of several blocks

if <condition>:
<block>
elif <condition>:
<block>

The italicized part in orange can be repeated as many times as is needed.

✓ Layout 4 example:

if model == "Ford":
print ("Ford model was purchased.")
elif model == "GM":
print ("GM model was purchased.")
elif model == "Chrysler":
print ("Chrysler model was purchased.")

Note: Indentation is very important when specifying a Python condition statement.  It tells Python how many statements will conditionally execute.