Assume"
s" is a string of lower case characters. Write a program that count up
the number of vowels contained in the string "s". Valid vowel are: "a",
"e", "i", "o", and "u". For example, if s="azcbobobegghakl", your
program should print:
Number of vowels :5
SOLUTION
textList = []
text = raw_input("Enter any string")
textList = list(text) #The function of keyword "list" is to turn test to list of words
a = textList.Count("a") #The "Count" function helps to count the number of letters
e = textList.Count("e")
i = textList.Count("i")
o = textList.Count("o")
u = textList.Count("u")
vowelCount = a + e + i + o + u
Print(vowelCount)
No comments:
Post a Comment