Exercie 73

Write a python algorithm which delete all vowels from a given string s. Example if s = "Python is hight level programming language", the algorithm returns the string: "Pthn s hght lvl prgrmmng lngg"


def deleteVowels(s):
# define the liste of vowels
vowels = ['a','e','y','u','i','o']

# initializing the string without vowels
s1 = ""

# iterate over all characters in the string s
for x in s:
if x not in vowels:
s1 = s1 + x
return s1

# Example
s = "Python is hight level programming language"
# display: Pthn s hght lvl prgrmmng lngg

Younes Derfoufi

Leave a Reply