🚀 Hurry! Offer Ends In
00 Days
00 Hours
00 Mins
00 Secs
Enroll Now
X
Questions




































Program to check whether given character is vowel or not.

Last Updated : 16 Jul 2025 Jan 22, Jul 24

Solution:

# Prompt the user to enter a character
c = input("Enter any char: ")

# Define a list of vowels (both lowercase and uppercase)
vowels = ['a', 'A', 'e', 'E', 'i', 'I', 'o', 'O', 'u', 'U']

# Check if the entered character is in the list of vowels
if c in vowels:
    # If true, print "Vowel"
    print("Vowel")
else:
    # If false, print "Not a vowel"
    print("Not a vowel")

 

OUTPUT:
Enter any char k
not a vowel

Explaination:

This code checks if a given character is a vowel:

  1. Input: Prompts the user to enter a character.
  2. Vowel List: Defines a list of vowels (both lowercase and uppercase).
  3. Condition: Checks if the character is in the vowel list.
  4. Output: Prints "Vowel" if true, otherwise prints "Not a vowel".
Report an error

Meanwhile you can watch this video

Watch Video
Latest Updates