From 3972ed80a9155ba5a1c1c332acb116c93b3dec68 Mon Sep 17 00:00:00 2001 From: Helen Kershaw Date: Fri, 15 Dec 2023 10:38:56 -0500 Subject: [PATCH 1/3] add y to vowels --- python/exercise1/vowel_counter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/exercise1/vowel_counter.py b/python/exercise1/vowel_counter.py index a50949a..9650355 100644 --- a/python/exercise1/vowel_counter.py +++ b/python/exercise1/vowel_counter.py @@ -2,14 +2,14 @@ def num_vowels(text): """Return the number of vowels in string.""" - vowels = "aeiou" + vowels = "aeiouy" num = 0 for v in vowels: num += text.lower().count(v) return num def num_consonants(text): - vowels = "aeiou" + vowels = "aeiouy" for letter in text: if letter not in vowels: print("consonant", letter) From 090a4c311d18d48e20e28c2e02f6f82740e7a6dd Mon Sep 17 00:00:00 2001 From: Helen Kershaw Date: Fri, 15 Dec 2023 10:54:43 -0500 Subject: [PATCH 2/3] return count of consontants rather than printing the consonant. --- python/exercise1/vowel_counter.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/exercise1/vowel_counter.py b/python/exercise1/vowel_counter.py index 9650355..8aaf9da 100644 --- a/python/exercise1/vowel_counter.py +++ b/python/exercise1/vowel_counter.py @@ -10,9 +10,11 @@ def num_vowels(text): def num_consonants(text): vowels = "aeiouy" + num = 0 for letter in text: if letter not in vowels: - print("consonant", letter) + num += text.lower().count(letter) + return num text = str(input("Enter a sentence: ")) From d4b560b309b00b33dcb42636c8bdea09274f96f6 Mon Sep 17 00:00:00 2001 From: Julius Lucks Date: Thu, 11 Sep 2025 12:52:58 -0500 Subject: [PATCH 3/3] Update python/exercise1/vowel_counter.py --- python/exercise1/vowel_counter.py | 1 + 1 file changed, 1 insertion(+) diff --git a/python/exercise1/vowel_counter.py b/python/exercise1/vowel_counter.py index 8aaf9da..e10230e 100644 --- a/python/exercise1/vowel_counter.py +++ b/python/exercise1/vowel_counter.py @@ -9,6 +9,7 @@ def num_vowels(text): return num def num_consonants(text): + return len(text) - num_vowels(text) vowels = "aeiouy" num = 0 for letter in text: