Shortened Solution (8: Anti Vowel) [Spoiler]


#1



Having completed the Codecademy Python course, I'm looking back over my code to see if I can shorten them with acquired knowledge. Here is what I came up with for anti vowel:


def anti_vowel(text):
    word = filter(lambda i: i not in "aeiouAEIOU", text)
    return word


#2

Very clean and concise piece of code! :raised_hands:


#3

EDIT: So I went back and managed to shorten it by a line:

def anti_vowel(text):
    return filter(lambda i: i not in "aeiouAEIOU", text)

Not much but improvements are improvements.


#4

Still impressive, In programming the simplest and most efficient way is most of the time the best way. :slight_smile:

Very DRY :sweat_smile:


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.