Challenge - 5 Problems
Pass Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of pass in a loop
What is the output of this code snippet?
Python
for i in range(3): pass print('Done')
Attempts:
2 left
💡 Hint
The pass statement does nothing but is syntactically needed.
✗ Incorrect
The loop runs 3 times doing nothing each time because of pass. Then it prints 'Done'.
❓ Predict Output
intermediate2:00remaining
Pass in function definition
What will be the output of this code?
Python
def greet(): pass print(greet())
Attempts:
2 left
💡 Hint
Functions without return return None by default.
✗ Incorrect
The function greet does nothing and returns None implicitly. So print outputs None.
❓ Predict Output
advanced2:00remaining
Pass in conditional blocks
What is the output of this code?
Python
x = 5 if x > 10: print('Greater') else: pass print('Done')
Attempts:
2 left
💡 Hint
pass does nothing but allows empty blocks.
✗ Incorrect
Since x is 5, the else block runs but does nothing due to pass. Then 'Done' is printed.
❓ Predict Output
advanced2:00remaining
Pass in class definition
What will this code print?
Python
class Empty: pass obj = Empty() print(type(obj))
Attempts:
2 left
💡 Hint
pass allows empty class bodies.
✗ Incorrect
The class Empty is defined with pass. Creating obj is valid. type(obj) shows the class name.
❓ Predict Output
expert2:00remaining
Pass effect on function behavior
What is the output of this code?
Python
def func(): if False: pass else: return 'Hello' print(func())
Attempts:
2 left
💡 Hint
pass does nothing and does not affect flow.
✗ Incorrect
The if condition is False, so else runs and returns 'Hello'. pass does not affect this.