Editor

Predict the Keyword Call

Beginner · Predict the output · from Python *args, **kwargs, Default Values, and Keyword Arguments

From the lesson: Python *args, **kwargs, Default Values, and Keyword Arguments

Think about ordering coffee. You always need to pick a size - that's required. But extras like oat milk, an extra shot, or caramel drizzle? Those are optional. You only mention them when you want them.

Read the lesson

What does this code print? Type the exact output.

def power(base, exponent=2):
    print(base ** exponent)

power(5)
power(2, 10)
power(exponent=3, base=4)
def power(base, exponent=2):
print(base ** exponent)
power(5)
power(2, 10)
power(exponent=3, base=4)

More Function Arguments exercises

All Python exercises · 50 practice problems · Functions quiz