Python @ DjangoSpin

PyPro #22 Vowels & Consonants

Buffer this pageShare on FacebookPrint this pageTweet about this on TwitterShare on Google+Share on LinkedInShare on StumbleUpon
Reading Time: 1 minutes

Vowels & Consonants in Python: A simple Python program to determine whether the entered letter is a vowel or a consonant.

Vowels & Consonants in Python

letter = input("Enter a letter: ")

if letter in 'aeiouAEIOU':						# using the membership operator 'in'
	print(letter, "is a vowel.")
else:
	print(letter, "is a consonant.")
Try it here.

See also:


Buffer this pageShare on FacebookPrint this pageTweet about this on TwitterShare on Google+Share on LinkedInShare on StumbleUpon