Quiz Complete, well Done!
To execute a block of code a specific number of times, you can use a for loop with the
function.
The keyword used to terminate a for loop prematurely is
.
What is the purpose of a 'for' loop?
What does the range() function in Python do?
How many parts does a for loop declaration consist of?
What does the 'range' function do in a 'for' loop?
What is a for loop used for in programming?
If you want to skip the current iteration and continue to the next one in a for loop, you use the
keyword.
The block of code inside the for loop is executed a
number of times.
Control flow
What is the purpose of a for loop?
Each time the loop runs, the loop variable takes on the value of the next
in the sequence.
What is the output of the following code?
for i in range(2, 6):
print(i)
In a for loop, which part specifies the number of iterations?
The range function can be used to iterate over a sequence of
.
Which keyword is used to initiate a 'for' loop in Python?
The range function can be used in for loops to generate a sequence of
.
Increment
Which of the following is a valid range for a for loop in Python?
How many times will the following 'for' loop iterate?
for i in range(5):
print(i)