Python Loops Work Sheet

By Mickey Arnold
Last updated 10 months ago
5 Questions

What is the output of code below?

for i in range(5):
print(i, end = " ")

What is the output of code below?

for x in range(3):
print("time", end = " ")

What is the output of code below?

j = 0
while j < 10:
j += 3
print(j)

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? 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()