What is the output of the following code snippet:
for i in range(2, 6):
print(i)
print(i)
A. 2
3
4
5
B. 2
3
4
5
C. 3
4
5
6
D. 1
2
3
4
Answer: Option A
Related Questions on Conditional Formatting (While and For Loops)
Which loop in Python is ideal for situations where you don't know the number of iterations?
A. For Loop
B. While Loop
C. Do-While Loop
D. Infinite Loop
What is the output of the following code snippet:for i in range(2, 6):
print(i)
A. 2
3
4
5
B. 2
3
4
5
C. 3
4
5
6
D. 1
2
3
4
Which loop is known for its pre-checking condition?
A. For Loop
B. While Loop
C. Do-While Loop
D. Infinite Loop
What is the purpose of the break statement in loops?
A. Exit the loop
B. Skip the current iteration
C. Continue to next iteration
D. Pause the loop
Join The Discussion