Here are a couple of assessments that I put together for conditional statements. This is related to my concept map on this topic.
- What is printed by the following block of python code?
x = 300
if x >= 42:
print “x”,
elif x >= 25:
print “y”,
else:
print “z”
(a) x
(b) x y
(c) y
(d) z
(e) x y z
(f) none of the above
- Fill in each blank with exactly one of the following phrases: can have, must have, or can’t have.
2.1 An if _____ a condition.
2.2 An if _____ an elif.
2.3 An if _____ an else.
2.4 An else _____ a condition.
2.5 An else _____ an execution block.