🐍Python Program #10: Check Whether a Character is a Vowel or Consonant | Python Programming
#python #pythonprogramming #pythonforbeginners #vowels #consonants #ifelse #pythonprojects #pythontutorial #python3
🔤 Learn how to check whether a given character is a vowel or consonant using Python in this beginner-friendly tutorial! This video explains the logic step-by-step in under 2 minutes with clean code and simple explanation.
✅ Great for Python beginners!
📌 Covered: input validation, character checks, if-else logic
1. Ask the user to enter a single alphabet character. (e.g., 'a')
2. First, check if the entered character is actually a letter:
We don’t want numbers or symbols (like 1, #, etc.)
You can use isalpha() function to verify it’s a letter.
3. Convert the character to lowercase using .lower()
This makes comparison easy regardless of input case (A/a)
4. Make a list of all vowel letters: a, e, i, o, u
5. Now check:
If the character is in the list of vowels → it's a *vowel*
Otherwise → it's a *consonant*
6. Print the result!
Subscribe for more bite-sized Python codes 🐍
code:
Check whether a character is a vowel or consonant
char = input("Enter a single alphabet: ")
if char.isalpha() and len(char) == 1:
char = char.lower()
if char in ('a', 'e', 'i', 'o', 'u'):
print(f"{char} is a Vowel.")
else:
print(f"{char} is a Consonant.")
else:
print("Invalid input! Please enter a single alphabet letter.")
💬 Got questions? Drop them below!
❤️ Like + Subscribe for more 1-min Python gems!
🔔 Don’t forget to Like, Subscribe, and hit the bell icon for more short & powerful Python tutorials every week!
python,python for beginners,asmr programming,check whether a character is a vowel or consonant,python program to check whether a character is vowel or not,python program to check a character is vowel or not,python program to check vowel or consonant character.,python program to check vowel or consonant,program to check a character is vowel or not,python program to check the given character is vowel or not,Python Programming,Python Program #10 Check if a Character is a Vowel,python for beginners,asmr programming,python program to check whether a character is vowel or not,python program to check a character is vowel or not,program to check a character is vowel or not,python program to check the given character is vowel or not,Python Programming,Python Program,vowel or consonant,vowel or consonant Python program,vowel,consonant,Python program to check whether character is vowel or consonant,Python tutorial,Vowel or consonant in python Python in 5 Minutes: Super Fast Beginner Guide
• Python in 5 Minutes: Super Fast Beginner G...
Python Variables and Data Types | Explained in 3 minutes with Examples | Python for Beginners
• Python Variables and Data Types | Explaine...
Master Python Loops (For loop & While loop) in Just 5 Minutes | Python For Beginners
• Master Python Loops (For loop & While loop...
💻Coding Python Calculator Program 🧮🐍
• 💻Coding Python Calculator Program 🧮🐍
How to Check If List is Empty in Python 🐍💻
• How to Check If List is Empty in Python 🐍💻
How to Reverse a String in Python Like a Pro!
• How to Reverse a String in Python Like a Pro!
Python Lists | 5 Cool Tricks of Lists in Python - You must know!
• 5 Cool Tricks To Use Lists in Python - You...
Python Programs | Python Programming - Playlist for logic building and practice
• Python Programs | Python Programming - Pla...