Python program to check whether a given character is an alphabet
kw.py
print("______________________________________________")print("Program to check a character is alphabet")print("______________________________________________")c=input("Enter the character ")if(len(c)==1):if(c=='a'orc=='A'orc=='e'orc=='E'orc=='i'orc=='I'orc=='o'orc=='O'orc=='u'orc=='U'):print(c,"is vowel and alphabet")elif((c>='a'andc<='z')or(c>='A'andc<='Z')):print(c,"is only an alphabet")else:print(c,"is not an alphabet")elif(len(c)==0):print("Enter valid character")else:print(c,"is set of characters")print("______________________________________________")
Output
kodingwindow@kw:~$ python3 kw.py
______________________________________________
Program to check a character is alphabet
______________________________________________
Enter the character U
U is vowel and alphabet
______________________________________________
kodingwindow@kw:~$ python3 kw.py
______________________________________________
Program to check a character is alphabet
______________________________________________
Enter the character AEIOU
AEIOU is set of characters
______________________________________________
Dear User, Thank you for visitng KodingWindow. If you are interested in technical articles, latest technologies, and our journey further, please follow us on LinkedIn.