I'm pretty sure my code is correct but it doesn't seem to returning the expected output:
input anti_vowel("Hey look words")
--> outputs: "Hey lk wrds"
.
Apparently it's not working on the 'e'
, can anyone explain why?
def anti_vowel(c):
newstr = ""
vowels = ('a', 'e', 'i', 'o', 'u')
for x in c.lower():
if x in vowels:
newstr = c.replace(x, "")
return newstr
One more simpler way can be extracting the non-vowel characters from string and returning them.