python method to filter vowels in a string
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
Here is what the above code is Doing:
1. Create a new string variable called newstr.
2. Create a tuple of vowels.
3. Loop through each character in the string.
4. If the character is in the tuple of vowels, replace it with an empty string.
5. Return the new string.