I've seen lots of solutions like "using a nested for loop" or using "Filter". It makes sense and seems clear but I really don't understand why my code is not working. For example del(t[i]) is wrong? or it is all because of the wrong place of "return"
or is it completely nonsense and am I thinking all wrong ?
the error message is "Oops, try again. Your function fails on anti_vowel("Hey look Words!"). It returns "Hey look Words!" when it should return "Hy lk Wrds!"."
def anti_vowel(text): vowels = ['a','i','u','e','o','A','I','U','E','O'] w='' t=str(text) #if I don't do it, it is giving me str int problem while vowels: #By this I want to ensure that the code runs until it look #for all the vowels. I am not sure it is correct or not. for i in range(0,len(text)): if t[i]!=vowels: w+=t[i] i+=1 else: del(t[i]) i+=1 return t #by this it is directly giving "hey look words". #why it doesn't use the loop? I tried to put the #return bottom alignment of while also but it didn't work either #also I tried to put break but it didn't work ofcourse