Kodewick
Start learning →
Basic←→0 / 80

Phone contacts

#043BasicSortingStrings4 min

Some names in your phone contacts start with a capital and some don't. Plain sorted puts every capital letter before every small one. Write sort_contacts(names) to sort them alphabetically ignoring case, without changing the names. An empty list gives [].

Examples
sort_contacts(["bob", "Alice", "carl"])→['Alice', 'bob', 'carl']
sort_contacts([])→[]
main.py
def sort_contacts(names):
    # your code here: compare the lower-case version of each name
    ordered = sorted(names)
    return ordered
Ctrl + Enter runs too
Result

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