Logic Building
# Take string input
s = input("Enter a string: ")
# Remove consonants
vowels = "aeiouAEIOU"
result = ""
for char in s:
if char in vowels or not char.isalpha():
result += char
print(f"Without consonants: {result}")Output
Enter a string: Hello World Without consonants: eo o
Keep only vowels and non-alphabetic characters.
Key Concepts:
- Keep vowels
- Keep non-alphabetic characters
- Remove consonants