Each of the following questions is worth 4 points.
while
loop when the boolean expression after the keyword
while
becomes false?
the loop stops
a local variable
not False
True
True and False
an argument
7 // 2
3
anything that can be turned into a value
from the corresponding argument in the function call
True and False
False
literals, variables, calculations, function calls
parameters
-=
True or False
True
not True
False
a statement
for
loop with the
range
function.
def print_cubes(min, max):
for n in range(min, max +1):
print(n * n * n
for
loop that prints the even numbers from 2
to 10 using the range
function.
for num in range(2,11,2):
print(num)
while
loop that asks the user for a number
greater than 10. num = int(input("Number greater than 10: "))
while num <= 10:
print(num, "is not greater than 10")
num = int(input("Number greater than 10: "))
print(num)
if signal == "green":
print("Go")
elif signal == "yellow":
print("Slow")
elif signal == "red":
print("Stop")
else:
print("Error")