This repository has been archived by the owner on Jul 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
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
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() |
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
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 | ||
|
||
|