We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Default Values

You can specify a default value for a function parameter, which is useful when a function has parameters that are "optional". They're created by using the assignment (=) operator inside the function signature:

def get_greeting(email, name="there"):
    print(f"Hello {name}, welcome! You've registered your email: {email}")

If we call it with both parameters, it uses the provided values:

get_greeting("lane@example.com", "Lane")
# Hello Lane, welcome! You've registered your email: lane@example.com

But if we omit the optional name parameter, it will use the default value instead:

get_greeting("lane@example.com")
# Hello there, welcome! You've registered your email: lane@example.com

Optional parameters (the ones with defaults) must come after all required parameters.

Assignment

Complete the get_punched and get_slashed functions. They both take two integers as arguments, health and armor.