Full Name

Full Name

Write a function that combines a first and last name into one title-cased string.

full_name(first, last)

Join first and last with a space, and make sure the result is title-cased (each word capitalized), regardless of how the inputs were capitalized.

Examples

full_name("ada", "lovelace")    // → "Ada Lovelace"
full_name("ALAN", "turing")     // → "Alan Turing"
full_name("grace", "HOPPER")    // → "Grace Hopper"

Walkthrough

Thinking it through

Two steps: combine the pieces, then normalize the casing.

def full_name(first, last):
    return f"{first} {last}".title()

An f-string builds "{first} {last}" with a single space between them. Then .title() — a built-in string method — capitalizes the first letter of every word in the result and lowercases the rest, so it doesn't matter whether the caller passed "ALAN", "alan", or "AlAn" — the output is always "Alan".

Calling .title() on the combined string (rather than calling it on first and last separately and then joining) is slightly simpler, and works identically here since there's only one space-separated boundary either way.

main.py
Console
Press Run to execute your code, or Submit to test and complete this problem.