6.2.3 Keyword (Named) Arguments

Unit: Unit 6: Functions • Interactive Practice

Quick Answer & Summary:

Interactive Python programming tutorial and practice in your browser.

Interactive Challenge (Run Live in Browser):

# Call functions using explicit keyword arguments
def send_email(recipient, subject, body, priority="NORMAL", cc=None):
    print(f"To: {recipient}")
    print(f"Subject: {subject} | Priority: {priority}")
    print(f"Body: {body}")
    if cc:
        print(f"CC: {cc}")

# Call using named keyword arguments in any order!
send_email(
    subject="System Launch Complete",
    body="The deployment succeeded without errors.",
    recipient="team@example.com",
    priority="HIGH"
)
Open in Live Interactive Python Sandbox →