cs/Practical File/questions/question_11.py
Neil Revin 780baf678e
chore: move question & output files
Move python question files to 'questions' directory
Move output files to 'outputs' directory
Copy output files to 'questions' for ease of viewing

Signed-off-by: Neil <neil@willofsteel.me>
2025-06-24 02:34:07 +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