From 3972ed80a9155ba5a1c1c332acb116c93b3dec68 Mon Sep 17 00:00:00 2001 From: Helen Kershaw Date: Fri, 15 Dec 2023 10:38:56 -0500 Subject: [PATCH 01/11] 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 02/11] 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 6d913fc6273859c64d8e70f1f3a7a04b6125f29d Mon Sep 17 00:00:00 2001 From: sanyatonwu <155703270+sanyatonwu@users.noreply.github.com> Date: Fri, 12 Apr 2024 16:06:19 -0500 Subject: [PATCH 03/11] Update python/exercise1/vowel_counter.py changed 'vowels' to 'consonants' --- python/exercise1/vowel_counter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/exercise1/vowel_counter.py b/python/exercise1/vowel_counter.py index 8aaf9da..c12047b 100644 --- a/python/exercise1/vowel_counter.py +++ b/python/exercise1/vowel_counter.py @@ -9,7 +9,7 @@ def num_vowels(text): return num def num_consonants(text): - vowels = "aeiouy" + consonants= "bcdfghjklmnpqrstvwxz" num = 0 for letter in text: if letter not in vowels: From 8a9c0070def10e6b68e18d9025d136b49d68695c Mon Sep 17 00:00:00 2001 From: sanyatonwu <155703270+sanyatonwu@users.noreply.github.com> Date: Fri, 12 Apr 2024 16:06:31 -0500 Subject: [PATCH 04/11] Update python/exercise1/vowel_counter.py delete line --- python/exercise1/vowel_counter.py | 1 - 1 file changed, 1 deletion(-) diff --git a/python/exercise1/vowel_counter.py b/python/exercise1/vowel_counter.py index c12047b..b5d1187 100644 --- a/python/exercise1/vowel_counter.py +++ b/python/exercise1/vowel_counter.py @@ -12,7 +12,6 @@ def num_consonants(text): consonants= "bcdfghjklmnpqrstvwxz" num = 0 for letter in text: - if letter not in vowels: num += text.lower().count(letter) return num From e230bdc824d30e87ac3114f7d2221bfe57775c5d Mon Sep 17 00:00:00 2001 From: sanyatonwu <155703270+sanyatonwu@users.noreply.github.com> Date: Fri, 12 Apr 2024 16:07:12 -0500 Subject: [PATCH 05/11] Update python/exercise1/vowel_counter.py changed 'letter' to 'c' --- python/exercise1/vowel_counter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/exercise1/vowel_counter.py b/python/exercise1/vowel_counter.py index b5d1187..2a351bb 100644 --- a/python/exercise1/vowel_counter.py +++ b/python/exercise1/vowel_counter.py @@ -12,7 +12,7 @@ def num_consonants(text): consonants= "bcdfghjklmnpqrstvwxz" num = 0 for letter in text: - num += text.lower().count(letter) + num1 += text.lower().count(c) return num text = str(input("Enter a sentence: ")) From 7c641ba207b7b1ec435757078fa3681d5d33be28 Mon Sep 17 00:00:00 2001 From: sanyatonwu <155703270+sanyatonwu@users.noreply.github.com> Date: Fri, 12 Apr 2024 16:10:40 -0500 Subject: [PATCH 06/11] Update python/exercise1/vowel_counter.py print the values of interest for vowels and consonants --- python/exercise1/vowel_counter.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/exercise1/vowel_counter.py b/python/exercise1/vowel_counter.py index 2a351bb..4c9aa1e 100644 --- a/python/exercise1/vowel_counter.py +++ b/python/exercise1/vowel_counter.py @@ -16,7 +16,8 @@ def num_consonants(text): return num text = str(input("Enter a sentence: ")) - +print("Number of vowels", num_vowels(text)) +print("Number of consonants", num_consonants(text)) print("Number of vowels", num_vowels(text)) print("Number of consonants", num_consonants(text)) From 4d077c0bb3fdaa75bfaa62a1be9bbe8c20eda785 Mon Sep 17 00:00:00 2001 From: sanyatonwu <155703270+sanyatonwu@users.noreply.github.com> Date: Fri, 12 Apr 2024 16:19:26 -0500 Subject: [PATCH 07/11] Update python/exercise1/vowel_counter.py --- python/exercise1/vowel_counter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/exercise1/vowel_counter.py b/python/exercise1/vowel_counter.py index 4c9aa1e..058a70c 100644 --- a/python/exercise1/vowel_counter.py +++ b/python/exercise1/vowel_counter.py @@ -10,7 +10,7 @@ def num_vowels(text): def num_consonants(text): consonants= "bcdfghjklmnpqrstvwxz" - num = 0 + num1 = 0 for letter in text: num1 += text.lower().count(c) return num From adf8bec135a27823d988cfe0d0560c9ff57e6c74 Mon Sep 17 00:00:00 2001 From: sanyatonwu <155703270+sanyatonwu@users.noreply.github.com> Date: Fri, 12 Apr 2024 16:21:08 -0500 Subject: [PATCH 08/11] Update python/exercise1/vowel_counter.py --- python/exercise1/vowel_counter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/exercise1/vowel_counter.py b/python/exercise1/vowel_counter.py index 058a70c..23e7b2f 100644 --- a/python/exercise1/vowel_counter.py +++ b/python/exercise1/vowel_counter.py @@ -13,7 +13,7 @@ def num_consonants(text): num1 = 0 for letter in text: num1 += text.lower().count(c) - return num + return num1 text = str(input("Enter a sentence: ")) print("Number of vowels", num_vowels(text)) From 72f5ee426ed769f6fa89d24bf08e522c7348acaa Mon Sep 17 00:00:00 2001 From: sanyatonwu <155703270+sanyatonwu@users.noreply.github.com> Date: Fri, 12 Apr 2024 16:21:37 -0500 Subject: [PATCH 09/11] Update python/exercise1/vowel_counter.py --- python/exercise1/vowel_counter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/exercise1/vowel_counter.py b/python/exercise1/vowel_counter.py index 23e7b2f..d5547ee 100644 --- a/python/exercise1/vowel_counter.py +++ b/python/exercise1/vowel_counter.py @@ -11,7 +11,7 @@ def num_vowels(text): def num_consonants(text): consonants= "bcdfghjklmnpqrstvwxz" num1 = 0 - for letter in text: + for c in consonants: num1 += text.lower().count(c) return num1 From 341438029d7ac08b6a4d4209c0ad133a0c3e0dc8 Mon Sep 17 00:00:00 2001 From: sanyatonwu <155703270+sanyatonwu@users.noreply.github.com> Date: Fri, 12 Apr 2024 16:25:09 -0500 Subject: [PATCH 10/11] Update vowel_counter.py --- python/exercise1/vowel_counter.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/python/exercise1/vowel_counter.py b/python/exercise1/vowel_counter.py index d5547ee..947bed3 100644 --- a/python/exercise1/vowel_counter.py +++ b/python/exercise1/vowel_counter.py @@ -18,7 +18,6 @@ def num_consonants(text): text = str(input("Enter a sentence: ")) print("Number of vowels", num_vowels(text)) print("Number of consonants", num_consonants(text)) -print("Number of vowels", num_vowels(text)) -print("Number of consonants", num_consonants(text)) + From 55de38389a61acecf212c96f76643ff7fd58a04c Mon Sep 17 00:00:00 2001 From: sanyatonwu <155703270+sanyatonwu@users.noreply.github.com> Date: Fri, 12 Apr 2024 16:25:57 -0500 Subject: [PATCH 11/11] Update 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 947bed3..d06aaa6 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 the number of consonants in string.""" consonants= "bcdfghjklmnpqrstvwxz" num1 = 0 for c in consonants: