Check a vowel

EasyIf-Else Programs · 32 of 64

Write a Python program to check whether a letter is a vowel.

Advertisement
Input
"A", "k"
Output
A True
k False

Approach

  1. Lower-case the letter and check membership in “aeiou”.

Solution

Python
for ch in ["A", "k"]:    if ch.lower() in "aeiou":        print(ch, True)    else:        print(ch, False)
Output
A True
k False

Line by line

Line 2

in on a string checks whether the character appears in it.

Advertisement

Learn the concept

New to this topic? Read the lesson, then come back.

More if-else programs

← All 64 If-Else Programs