Exercise
Vowel Check - Conditional
Objective
Develop a Python program to prompt the user for a symbol and respond if it's a vowel (in lowercase), a digit, or any other symbol, using "if".
Example Python Exercise
Show Python Code
# Prompt the user for a symbol
symbol = input("Enter a symbol: ")
# Check if the symbol is a vowel (in lowercase)
if symbol in 'aeiou':
print("It's a vowel.")
# Check if the symbol is a digit
elif symbol.isdigit():
print("It's a digit.")
# If it's neither a vowel nor a digit, it's another symbol
else:
print("It's another symbol.")
Output
Case 1:
Enter a symbol: a
It's a vowel.
Case 2:
Enter a symbol: 5
It's a digit.
Case 3:
Enter a symbol: #
It's another symbol.
Share this Python Exercise