Loops Quiz
By Mickey Arnold
starstarstarstarstarstarstarstarstarstar
Last updated 10 months ago
5 Questions
20 points
20
Question 1
1.
What is the output?x = 0for r in range( 3, 10 ): x = x + rprint( x )
What is the output?
x = 0
for r in range( 3, 10 ):
x = x + r
print( x )
20 points
20
Question 2
2.
What is the output?
i = 0while i < 21: i += 5print(i)
What is the output?
i = 0
while i < 21:
i += 5
print(i)
20 points
20
Question 3
3.
What is the output? You can type in the box.
m = 0word = "school"for let in word: if m % 2 == 0: print(let) m += 1
What is the output? You can type in the box.
m = 0
word = "school"
for let in word:
if m % 2 == 0:
print(let)
m += 1
20 points
20
Question 4
4.
What is the output?
words = "computer programming"b = 0for let in words: if let == "m": b = b + 2 else: b = b + 1print(b)
What is the output?
words = "computer programming"
b = 0
for let in words:
if let == "m":
b = b + 2
else:
b = b + 1
print(b)
20 points
20
Question 5
5.
What is the output?You can type in the box.
x = 4while x > 0: y = 2 while y > 0: print("#", end = " ") y -= 1 x -= 1print()
What is the output?You can type in the box.
x = 4
while x > 0:
y = 2
while y > 0:
print("#", end = " ")
y -= 1
x -= 1
print()