Created
February 13, 2018 08:47
-
-
Save MohanSha/c479cc4ad9bb112c39b8edbef51f9d09 to your computer and use it in GitHub Desktop.
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.
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
# 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. | |
vowels = ['a', 'e', 'i', 'o', 'u'] | |
counter = [0, 0, 0, 0, 0] | |
def count_vowels(string): | |
for i in range(0, 5): | |
counter[i] = string.count(vowels[i]) | |
count_vowels(raw_input('String: ')) | |
for i in range(0, 5): | |
print vowels[i] + ": " + str(counter[i]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment