Anti_vowel


#1



I do not understand why we write a_vowel = False?  Can someone explain me the loop step by step

def anti_vowel(text):
    no_vowel = []
    letters = "AaEeOoUuIi"
    for n in text:
        for vowel in letters:
            a_vowel = False
            if n == vowel:
                a_vowel = True
                break
        if not a_vowel:
            no_vowel.append(n)
                
             
                 
    return "".join(no_vowel)            
                 
                 
                 
print anti_vowel("hello")   



















Replace this line with your code.


#2

you don't understand the solution you have written? This solution loops over text, then for each letter in text, it loops over vowel, to see if it is a vowel, if it is, set a_vowel to true, and break the current loop, so it goes to execute the if statement, if not True is false, so nothing gets append. However, if it is not a vowel, a_vowel is false, so if not False is true, and the letter gets appended. Add print statements to your code to see what is happening and better understand it