Q:

python3 vowels and consonants filter

def anti_vowel(c):
    newstr = c
    vowels = ('a', 'e', 'i', 'o', 'u')
    for x in c.lower():
        if x in vowels:
            newstr = newstr.replace(x,"")

    return newstr
0
def getVowels(text):

vowel_letters = []
vowel_list = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U',]

for vowels in text:
    if vowels in vowel_list:
        vowel_letters.append(vowels)

return vowel_letters

print(getVowels('Hi, How are you today!'))
## Output: ['i', 'o', 'a', 'e', 'o', 'u', 'o', 'a']
0
# Python3 code to demonstrate working of  
# Remove all consonents from string 
# Using list comprehension 
  
# initializing string 
test_str = "Gfg is best for geeks"
  
# printing original string 
print("The original string is : " + test_str) 
  
# Remove all consonents from string 
# Using list comprehension 
res = "".join([chr for chr in test_str if chr in "aeiouAEIOU"]) 
  
# printing result  
print("String after consonents removal : " + str(res))  
0
letterList = ['a', 'b', 'c', 'd']
vowelList = []

for letter in letterList:
    if letter in 'aeiou':
        vowelList.append(letter)
0
# Python3 code to demonstrate working of  
# Remove all consonents from string 
# Using loop 
  
# initializing string 
test_str = "Gfg is best for geeks"
  
# printing original string 
print("The original string is : " + test_str) 
  
# Remove all consonents from string 
# Using loop 
res = [] 
for chr in test_str: 
    if chr in "aeiouAEIOU": 
        res.extend(chr) 
res = "".join(res) 
  
# printing result  
print("String after consonents removal : " + str(res))  
0
class Vowels(object):
    def __init__(self, vowelList):
        self.vowelList = vowelList

        lettersList = self.vowelList.s.split(",")
        self.vowelList = [letter for letter in self.lettersList if letter in 'aeiou']
0
def anti_vowel(text):
  new_text = ""
  for i in text:
    if i == 'a' or i == 'A':
      pass
    elif i == 'e' or i == 'E':
      pass
    elif i == 'I' or i == 'i':
      pass
    elif i == 'o' or i == 'O':
      pass
    elif i == 'u' or i == 'U':
      pass
    else:
      new_text = new_text + i
  return new_text

print anti_vowel('Hey look Words!')
0
def eliminate_consonants(x):
        vowels= ['a','e','i','o','u']
        for char in x:
            if char in vowels:
                print(char,end = "")

eliminate_consonants('mississippi')
0

New to Communities?

Join the community