Challenge - 5 Problems
Continue Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of loop with continue inside if
What is the output of this Python code?
for i in range(5):
if i == 2:
continue
print(i, end=' ')Python
for i in range(5): if i == 2: continue print(i, end=' ')
Attempts:
2 left
💡 Hint
Remember, continue skips the rest of the current loop iteration.
✗ Incorrect
When i equals 2, the continue statement skips the print statement for that iteration. So 2 is not printed.
❓ Predict Output
intermediate2:00remaining
Continue in nested loops
What will be printed by this code?
for i in range(3):
for j in range(3):
if j == 1:
continue
print(f"{i},{j}", end=' ')Python
for i in range(3): for j in range(3): if j == 1: continue print(f"{i},{j}", end=' ')
Attempts:
2 left
💡 Hint
Continue skips printing when j equals 1.
✗ Incorrect
The inner loop skips printing when j is 1, so only j=0 and j=2 print for each i.
❓ Predict Output
advanced2:00remaining
Continue with else clause in loop
What is the output of this code?
for i in range(3):
if i == 1:
continue
print(i)
else:
print('Done')Python
for i in range(3): if i == 1: continue print(i) else: print('Done')
Attempts:
2 left
💡 Hint
The else block runs after the loop finishes normally.
✗ Incorrect
The loop skips printing 1 due to continue, prints 0 and 2, then prints 'Done' after the loop.
❓ Predict Output
advanced2:00remaining
Continue inside while loop
What will this code print?
i = 0
while i < 5:
i += 1
if i == 3:
continue
print(i, end=' ')Python
i = 0 while i < 5: i += 1 if i == 3: continue print(i, end=' ')
Attempts:
2 left
💡 Hint
Continue skips printing when i is 3.
✗ Incorrect
When i is 3, continue skips the print statement, so 3 is not printed.
❓ Predict Output
expert3:00remaining
Continue with multiple conditions and loop control
What is the output of this code?
result = []
for x in range(1, 6):
if x % 2 == 0:
continue
if x == 5:
break
result.append(x)
print(result)Python
result = [] for x in range(1, 6): if x % 2 == 0: continue if x == 5: break result.append(x) print(result)
Attempts:
2 left
💡 Hint
Continue skips even numbers, break stops loop at 5.
✗ Incorrect
Only odd numbers less than 5 are appended: 1 and 3. When x is 5, loop breaks before append.