I am very new to programming in general and have started with Python. I am working through various problems to try and better my understanding.
I am trying to defin
You should not delete items from a list while iterating through it. You will find numerous posts on Stack Overflow explaining why.
I would use the filter function
>>> vowels = 'aeiouAEIOU'
>>> myString = 'This is my string that has vowels in it'
>>> filter(lambda i : i not in vowels, myString)
'Ths s my strng tht hs vwls n t'
Written as a function, this would be
def anti_vowel(text):
vowels = 'aeiouAEIOU'
return filter(lambda letter : letter not in vowels, text)
Test
>>> anti_vowel(myString)
'Ths s my strng tht hs vwls n t'