Basic: Remove Vowels

Question:

Given a string as an input, please create a function that would remove all vowels (‘a’, ‘i’, ‘u’, ‘e’, ‘o’) from that string. For simplicity, consider all characters in the input string are in lower case.


Answer:

def remove_vowel(sentence):
  res = ''
  for i in sentence:
    if i not in ['a', 'i', 'u', 'e', 'o']: 
      res = res + i
  return res

# call the function
print(remove_vowel('hello I am here'))

👍 Have fun while coding with Python!

👌 Please subscribe to receive notifications on future challenges.

💬 If you have any questions simply write a comment down below.

Leave a Comment