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

16 lines
484 B
Python

# Question: Write a Python program to check if a character is an uppercase or lowercase letter.
def main(char: str) -> None:
if char.isupper():
print(f"{char} is an uppercase letter.")
elif char.islower():
print(f"{char} is a lowercase letter.")
else:
raise ValueError("Invalid input. Please enter an alphabetic character.")
if __name__ == '__main__':
main('A')
main('a')
main('B')
main('b')
main('1') # also works with a int