Loading Skulpt Python Interpreter...

Loading from jsDelivr CDN. This should be fast and reliable.

Vowel Count

Easy
String
Acceptance: 96.8%

Have the function VowelCount(text) take the text parameter being passed and return the number of vowels the string contains (a, e, i, o, u). For example: if text is "All cows eat grass" then your program should return 5. The vowels are case insensitive, so both 'A' and 'a' should be counted.

Examples

Example 1:

Input:"All cows eat grass"
Output:5
Explanation:A-l-l c-o-w-s e-a-t g-r-a-s-s contains: A, o, e, a, a = 5 vowels

Example 2:

Input:"Hello World"
Output:3
Explanation:H-e-l-l-o W-o-r-l-d contains: e, o, o = 3 vowels

Example 3:

Input:"Programming"
Output:3
Explanation:P-r-o-g-r-a-m-m-i-n-g contains: o, a, i = 3 vowels

Constraints

  • 1 <= text.length <= 1000
  • text will contain only letters and spaces
  • Count both uppercase and lowercase vowels
  • Return the count as an integer

Code Editor

python