cs/practical-file/questions/question_11.py
2025-06-24 02:37:47 +05:30

18 lines
488 B
Python

# Question: Write a Python program to check whether a given character is a vowel or consonant.
def main(char: str) -> None:
vowels = 'aeiou'
if char.lower() in vowels:
print(f"{char} is a vowel.")
elif char.isalpha():
print(f"{char} is a consonant.")
else:
raise ValueError("Invalid input. Please enter an alphabetic character.")
if __name__ == '__main__':
main('a')
main('b')
main('A')
main('1') # also works with a int