Python Loops Work Sheet
By Mickey Arnold
starstarstarstarstarstarstarstarstarstar
Last updated 10 months ago
5 Questions
1 point
1
Question 1
1.
What is the output of code below?
for i in range(5): print(i, end = " ")
What is the output of code below?
for i in range(5):
print(i, end = " ")
1 point
1
Question 2
2.
What is the output of code below?
for x in range(3): print("time", end = " ")
What is the output of code below?
for x in range(3):
print("time", end = " ")
1 point
1
Question 3
3.
What is the output of code below?
j = 0while j < 10: j += 3print(j)
What is the output of code below?
j = 0
while j < 10:
j += 3
print(j)
1 point
1
Question 4
4.
What is the output of code below?
word = "september"for let in word: if let != "m": print(let, end = " ") else: break
What is the output of code below?
word = "september"
for let in word:
if let != "m":
print(let, end = " ")
else:
break
1 point
1
Question 5
5.
What is the output of code below? Use show your work box to show output.
x = 3while x > 0: y = 3 while y > 0: print("-", end = " ") y -= 1 x -= 1 print()
What is the output of code below? Use show your work box to show output.
x = 3
while x > 0:
y = 3
while y > 0:
print("-", end = " ")
y -= 1
x -= 1
print()