← Quiz: Python Functions: all 15 questions
Quiz: Python Functions · Question 2 of 15
What does this print? (code)
What does this print?
def power(base, exp=2):
return base ** exp
print(power(3), power(2, 3))
- A.6 6
- B.9 8
- C.9 6
- D.8 9
Answer & explanation
Correct answer: 9 8
power(3) uses the default exp = 2 → 9. power(2, 3) = 8.
Can you get the rest right without peeking?
Take the timed Quiz: Python Functions quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →