Asked by Anonymous
Assume s is a string of lower case characters.
Write a program that counts up the number of vowels contained in the string s. Valid vowels are: 'a', 'e', 'i', 'o', and 'u'. For example, if s = 'azcbobobegghakl', your program should print:
Number of vowels: 5
For problems such as these, do not include raw_input statements or define the variable s in any way. Our automating testing will provide a value of s for you - so the code you submit in the following box should assume s is already defined.
Write a program that counts up the number of vowels contained in the string s. Valid vowels are: 'a', 'e', 'i', 'o', and 'u'. For example, if s = 'azcbobobegghakl', your program should print:
Number of vowels: 5
For problems such as these, do not include raw_input statements or define the variable s in any way. Our automating testing will provide a value of s for you - so the code you submit in the following box should assume s is already defined.
Answers
Answered by
pasa
> vowels = "aeiou"
> [x for x in "azcbobobegghakl" if x in vowels]
['e', 'e', 'i', 'a']
> len([x for x in "azcbobobegghakl" if x in vowels])
4
> [x for x in "azcbobobegghakl" if x in vowels]
['e', 'e', 'i', 'a']
> len([x for x in "azcbobobegghakl" if x in vowels])
4
There are no AI answers yet. The ability to request AI answers is coming soon!
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.