Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

Commit

Permalink
Resolve #93 (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
shorodilov authored Nov 27, 2023
2 parents 457b071 + 2815484 commit b44840d
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/vowels/checkvowels.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
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):
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()
12 changes: 12 additions & 0 deletions tests/vowels/test_checkvowels.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

from vowels.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


0 comments on commit b44840d

Please sign in to comment.