Expected:
>>> removeVowels('apple')
"ppl"
>>> removeVowels('Apple')
"ppl"
>>> removeVowels('Banana')
'Bnn'
Code (Beginner):
def removeVowels(word):
vowels = ('a', 'e', 'i', 'o', 'u')
for c in word:
if c in vowels:
res = word.replace(c,"")
return res
How do I both lowercase and uppercase?
re.sub('[aeiou]', '', 'Banana', flags=re.I)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With