#266 · Working with data · Intermediate · 60 XP · about 12 min
People typed their names into a sign-up form any way they liked: ' ada LOVELACE ', 'Ada Lovelace', "mary-jane o'neil". Write clean_names(names) that tidies every name and returns the cleaned names as a list, without repeats.
To clean a name:
- or an apostrophe '. Every other letter is lower case.After cleaning, leave out names that are empty, and keep only the first copy of names that are now identical. Keep the names in the order they first appear.
clean_names([' ada LOVELACE ', 'Ada Lovelace', 'grace hopper']) # returns ['Ada Lovelace', 'Grace Hopper'] clean_names(["mary-jane o'neil", 'ALAN turing', ' ']) # returns ["Mary-Jane O'Neil", 'Alan Turing']
0 <= len(names) <= 10000First solves only, ranked by stars and then time.