-
-
Save stephengruppetta/9ae3fab1962d66aa20e77cf47a44dbe1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
some_names = [ | |
"Robert", | |
"Ishaan", | |
"Max", | |
"Trevor", | |
"Alexandra", | |
"Albert", | |
"Christine", | |
] | |
def get_number_of_a_s(item): | |
return item.lower().count("a") | |
reordered_names = sorted(some_names, key=get_number_of_a_s) | |
print(*reordered_names, sep="\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment