From edd6fa42ed911ca96a337643783221d04b63564c Mon Sep 17 00:00:00 2001 From: Rishitha-VasiReddy Date: Thu, 23 Nov 2023 20:56:55 -0500 Subject: [PATCH 1/4] [Solved] Check vowels #93 --- src/vowels/checkvowels.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/vowels/checkvowels.py diff --git a/src/vowels/checkvowels.py b/src/vowels/checkvowels.py new file mode 100644 index 0000000..ed994e1 --- /dev/null +++ b/src/vowels/checkvowels.py @@ -0,0 +1,17 @@ +def is_character_vowel(char): + vowels = "aeiouAEIOU" + return char in vowels + +def main(): + user_input = input("Enter a character: ") + + if len(user_input) == 1 and user_input.isalpha(): + if is_character_vowel(user_input): + print(f"The character '{user_input}' is a vowel.") + else: + print(f"The character '{user_input}' is not a vowel.") + else: + print("Please enter a single alphabetic character.") + +if __name__ == "__main__": + main() From 4cfcfa60dbd33ab70c8fb78eca29b013e348b445 Mon Sep 17 00:00:00 2001 From: Rishitha-VasiReddy Date: Thu, 23 Nov 2023 20:57:31 -0500 Subject: [PATCH 2/4] [Solved] Check vowels #93 --- tests/vowels/test_checkvowels.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 tests/vowels/test_checkvowels.py diff --git a/tests/vowels/test_checkvowels.py b/tests/vowels/test_checkvowels.py new file mode 100644 index 0000000..9bc0782 --- /dev/null +++ b/tests/vowels/test_checkvowels.py @@ -0,0 +1,11 @@ + +from checkvowels import is_character_vowel + +def test_is_character_vowel(): + assert is_character_vowel('a') == True + assert is_character_vowel('b') == False + assert is_character_vowel('A') == True + assert is_character_vowel('1') == False + assert is_character_vowel('@') == False + + From ffca08a81a38a72a02f994dddf889f7de32cc0a7 Mon Sep 17 00:00:00 2001 From: Rishitha-VasiReddy Date: Fri, 24 Nov 2023 23:33:20 -0500 Subject: [PATCH 3/4] Update tests/vowels/test_checkvowels.py Co-authored-by: Serhii Horodilov --- tests/vowels/test_checkvowels.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/vowels/test_checkvowels.py b/tests/vowels/test_checkvowels.py index 9bc0782..c7a7492 100644 --- a/tests/vowels/test_checkvowels.py +++ b/tests/vowels/test_checkvowels.py @@ -1,5 +1,6 @@ -from checkvowels import is_character_vowel +from vowels.checkvowels import is_character_vowel + def test_is_character_vowel(): assert is_character_vowel('a') == True From 2815484330982e1ed59ec9550458144b9b0e5d60 Mon Sep 17 00:00:00 2001 From: Rishitha-VasiReddy Date: Sat, 25 Nov 2023 01:17:16 -0500 Subject: [PATCH 4/4] Update checkvowels.py Added docstrings --- src/vowels/checkvowels.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/vowels/checkvowels.py b/src/vowels/checkvowels.py index ed994e1..edb5e01 100644 --- a/src/vowels/checkvowels.py +++ b/src/vowels/checkvowels.py @@ -1,9 +1,21 @@ def is_character_vowel(char): + """ + Check if a given character is a vowel. + + Parameters: + - char (str): The character to be checked. + + Returns: + - bool: True if the character is a vowel, False otherwise. + """ vowels = "aeiouAEIOU" return char in vowels def main(): user_input = input("Enter a character: ") + """ + Main function to get user input and determine if the entered character is a vowel. + """ if len(user_input) == 1 and user_input.isalpha(): if is_character_vowel(user_input):