2. Topic 2(COLON) Programming Fundamentals in Python
Lesson 2.4: Iteration: Loops — Quiz
Test your understanding of lesson 2.4: iteration: loops with 5 practice questions.
Practice Questions
Question 1
What is the output of the following code?
\ndefinite_list = [1, 2, 3, 4, 5]\nfor number in definite_list:
print(number)
\ndefinite_list = [1, 2, 3, 4, 5]\nfor number in definite_list:
print(number)
Question 2
Which loop is suitable for performing an action until a specific condition is false?
Question 3
What will be the output of the following code?
\ncount = 0\nwhile count < 3:
print(count)
count += 1
\ncount = 0\nwhile count < 3:
print(count)
count += 1
Question 4
In Python, what function is commonly used with a
for loop to generate a sequence of numbers?Question 5
What happens when you do not update the variable in a
while loop that is used as its condition?