Friday 25 December 2020

Check whether given character is a vowel or not

Python program to check whether given character is a vowel or not.

Python Code:

myChar = input("Enter a character: ")

if(myChar=='A' or myChar=='E' or myChar=='I' or myChar=='O' or myChar=='U' 
   or myChar=='a' or myChar =='e' or myChar=='i' or myChar=='o' or myChar=='u'):
    print("'",  myChar, "' is a Vowel.")
else:
    print("'",  myChar, "'is a Consonant.")

Output of program

Enter a character: A
' A ' is a Vowel.



No comments:

Post a Comment