🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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))
  1. A.6 6
  2. B.9 8
  3. C.9 6
  4. 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 →