Kodewick
Start learning →
Basic←→0 / 80

Leaderboard line

#025BasicStrings5 min

The mini game saves its leaderboard as lines of text like "Kai: 120", maybe with spaces around the colon. Write parse_score(line) to return (name, score): the name without spaces around it, the score as a whole number.

Examples
parse_score("Kai: 120")→('Kai', 120)
parse_score("Lina:85")→('Lina', 85)
main.py
def parse_score(line):
    name = ""
    score = 0
    # your code here: split at the colon; name is the trimmed name, score the score as an int
    return name, score
Ctrl + Enter runs too
Result

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