Kodewick
Start learning →
Basic←→0 / 80

Bus stop sign

#027BasicStringsLoops5 min

A new bus route needs its sign, but the driver jotted the stop names down with messy case and extra spaces. Write route_sign(stops): trim each name, capitalise each word, then join them into one line with " > ". No stops gives an empty string.

Examples
route_sign(["park", " school ", "LIBRARY"])→'Park > School > Library'
route_sign([])→''
main.py
def route_sign(stops):
    clean = []
    for s in stops:
        # your code here: put the tidied name (strip then title) into clean
        pass
    # your code here: join clean with " > " and return it
    return ""
Ctrl + Enter runs too
Result

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