Thursday
March 23, 2017

Post a New Question

Posted by on Thursday, October 24, 2013 at 10:27am.

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.

  • Computer Programming using python - , Wednesday, October 30, 2013 at 3:59pm

    > 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

Answer This Question

First Name:
School Subject:
Answer:

Related Questions

More Related Questions

Post a New Question