From 63c84b7daaabf32a0d0c081d7cfd7b86dc791bf0 Mon Sep 17 00:00:00 2001 From: Sarvasv Arora <50026351+SarvasvX@users.noreply.github.com> Date: Tue, 9 Jul 2019 21:35:57 +0530 Subject: [PATCH] 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. --- snippets/count_vowels.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/snippets/count_vowels.md b/snippets/count_vowels.md index 256009312..2330f726c 100644 --- a/snippets/count_vowels.md +++ b/snippets/count_vowels.md @@ -8,11 +8,11 @@ Use a regular expression to count the number of vowels `(A, E, I, O, U)` in a st import re -def count_vowels(str): - return len(len(re.findall(r'[aeiou]', str, re.IGNORECASE))) -``` +def count_vowels (str): +    return len (re.findall (r '[aeiou]', str, re.IGNORECASE)) +`` ` -``` python -count_vowels('foobar') # 3 -count_vowels('gym') # 0 +`` `python +print(count_vowels('foobar')) # 3 +print(count_vowels('gym'))# 0 ```