I'm beginning to learn Python and I'm trying to create a function that removes vowels from a given string. This is my Code :
def anti_vowel(text):
li = []
for l in text:
li.append(l)
while 'a' in li:
li.remove('a')
while 'A' in li:
li.remove('A')
while 'A' in li:
li.remove('e')
while 'e' in li:
li.remove('E')
while 'E' in li:
li.remove('i')
while 'i' in li:
li.remove('I')
while 'I' in li:
li.remove('o')
while 'o' in li:
li.remove('O')
while 'u' in li:
li.remove('u')
while 'U' in li:
li.remove('U')
return "".join(li)
I get the "list.remove(x): x not in list" error when I try to run it. I know this error's been already asked about here but I didn't really get the answers in those specific cases. thanks for reading and please help :)