Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Count Vowels in a String

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

Your question is Count Vowels in a String. 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

Write a function that takes a string s and returns the count of vowels (a, e, i, o, u) in it. The function should handle both uppercase and lowercase vowels.

Constraints

  • The input string s can be empty.
  • The length of s will not exceed 1000 characters.

Function Signature

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