Created
April 1, 2018 13:13
-
-
Save ripiuk/55df60be1823a2e1ff932f916e2f562d to your computer and use it in GitHub Desktop.
Sort words by the number of vowels
This file contains hidden or 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
data = ['some str', 'longer str', 'the biggest string', 'small one'] | |
vowels = 'eyuioa' | |
data.sort(key=lambda x: sum(ch in vowels for ch in x)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment