Fixed error in code

len() was used twice, which produced error. Fixed that.
Also included print() statements, so that the function call actually prints the no. of vovels.
This commit is contained in:
Sarvasv Arora
2019-07-09 21:35:57 +05:30
committed by GitHub
parent 5424f64e2c
commit 63c84b7daa

View File

@ -9,10 +9,10 @@ import re
def count_vowels (str):
return len(len(re.findall(r'[aeiou]', str, re.IGNORECASE)))
    return len (re.findall (r '[aeiou]', str, re.IGNORECASE))
`` `
`` `python
count_vowels('foobar') # 3
count_vowels('gym') # 0
print(count_vowels('foobar')) # 3
print(count_vowels('gym'))# 0
```