I want to write a for loop that tests two functions on a list. First one gives back an int, second a boolean. If boolean == False the function should remove the element from the list so in the end after calling the function L should have mutated. Here is an example.
def f(i):
    return i + 2
def g(i):
    return i > 5
L = [0, -10, 5, 6, -4]
def applyF_filterG(L, f, g):
    for i in L:
        if g(f(i)) == False:        
            L.remove(i)
L = [5, 6]
My problem is that with the function written above I get L = [-10, 5, 6] back because if i is removed, the i+1 turns into an i+2 because of the removed element. Does anybody know how to solve this? Big thanks!
 
     
    