1. Which loop in Python is ideal for situations where you don't know the number of iterations?
2. What is the output of the following code snippet:
for i in range(2, 6):
print(i)
for i in range(2, 6):
print(i)
3. Which loop is known for its pre-checking condition?
4. What is the purpose of the break statement in loops?
5. In a for loop, what does the range() function return?
6. What is the output of the code:
x = 1
while x < 5:
print(x)
x += 1
x = 1
while x < 5:
print(x)
x += 1
7. What is the purpose of the else clause in a loop?
8. What will be the output of the following code:
for i in range(5, 0, -1):
print(i)
for i in range(5, 0, -1):
print(i)