Skip to content

Commit 1c04c50

Browse files
Merge pull request #1591 from Aliwahid17/patch-2
i update that function and make it fast
2 parents 0c60c71 + e202c59 commit 1c04c50

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

Count the Number of Each Vowel

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
1-
21
vowels = 'aeiou'
3-
42
ip_str = 'Hello, have you tried our tutorial section yet?'
5-
6-
ip_str = ip_str.casefold()
7-
8-
count = {}.fromkeys(vowels,0)
3+
count = 0
94

105
for char in ip_str:
11-
if char in count:
12-
count[char] += 1
6+
if char in vowels:
7+
count += 1
138

149
print(count)

0 commit comments

Comments
 (0)