-
-
Save stephengruppetta/f94d39e4e966420d3f7128ca767172de 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", | |
] | |
# First order alphabetically | |
some_names.sort() | |
# Then order by number of 'a's | |
some_names.sort( | |
key=lambda item: item.lower().count("a") | |
) | |
print(*some_names, sep="\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment