Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Vowel Counting Coding Task

EasyPython00:00
Practice interviewer
In session
5 left
00:00

Your question is Vowel Counting Coding Task. Start with the requirements on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

Quantiphi's text-processing workflows often need simple character-level statistics before applying later transformations. Write a function that counts the number of English vowels in a given text string.

Treat a, e, i, o, and u as vowels, regardless of case. Do not count y as a vowel. Spaces, punctuation, digits, and other characters should be ignored.

Formal Specification

Implement count_vowels(text).

  • Input: text, a string containing zero or more characters.
  • Output: An integer representing the total number of vowel characters in text.
  • The function must not modify the input string.

Constraints

  • 0 <= len(text) <= 10^5
  • Vowels are limited to the English letters a, e, i, o, and u
  • Uppercase and lowercase letters must be treated identically
  • y is not considered a vowel

Function Signature

def count_vowels(text):
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output