Write a Python program to check whether an alphabet is a vowel or consonant

Introduction

Write a Python program to check whether an alphabet is a vowel or consonant. I have used python 3.7 compiler for debugging purpose.

str = input("Input a letter of the alphabet: ")
 
if str in ('a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U', 'A', 'E'):
    print("%s is a vowel." % str)
elif str == 'y':
    print("Sometimes letter y stand for vowel, sometimes stand for consonant.")
else:
    print("%s is a consonant." % str) 

Result

Write a Python program to check whether an alphabet is a vowel or consonant
Write a Python program to check whether an alphabet is a vowel or consonant

Leave a Comment