p
y
c
h
a
l
l
e
n
g
e
r
Home
Python Basics
Time to Practice I
Count vowels in a string
Count vowels in a string
Write a function
count_vowels
that takes a string as input and returns the number of vowels (
a, e, i, o, u
) in the string.
reset
vowels = 'aeiou' def count_vowels(str):
# complete function here...
print(count_vowels('hello world')) # expected output: 3 print(count_vowels('python')) # expected output: 1
Python
Setting up Python environment...
Output