forked from karan/Projects
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Karan Goel
committed
Jul 11, 2013
1 parent
2a8b275
commit 9a41dc4
Showing
1 changed file
with
17 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
""" | ||
Count Vowels - Enter a string and the program counts | ||
the number of vowels in the text. For added complexity | ||
have it report a sum of each vowel found. | ||
""" | ||
|
||
string = raw_input('Enter a string: ').lower() | ||
|
||
vowels = ['a', 'e', 'i', 'o', 'u'] | ||
counts = dict(zip(vowels, [0, 0, 0, 0, 0])) | ||
|
||
for vowel in counts: | ||
for char in string: | ||
if vowel == char: | ||
counts[vowel] += 1 | ||
|
||
print counts |