Post a New Question

Computer Programming using python

posted by .

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 -

    > 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])

Answer This Question

First Name:
School Subject:

Related Questions

More Related Questions

Post a New Question