Kodewick
Start learning →
Basic←→0 / 80

Name badges

#026BasicStrings5 min

The sign-up sheet has names like "Lee, Ann": family name first, given name after the comma. The badge needs it the other way round: "Ann Lee". Write badge_name(entry) to return the badge name, with any extra spaces around the comma removed.

Examples
badge_name("Lee, Ann")→'Ann Lee'
badge_name("Garcia,Maria")→'Maria Garcia'
main.py
def badge_name(entry):
    # your code here: split(",") into family and given
    # your code here: trim both, join as given then family, and return it
    return entry
Ctrl + Enter runs too
Result

Run tries the examples. When they look right, Submit.