def f(i):
return i + 2
def g(i):
return i > 5
def applyfg(L,f,g):
for i in L:
# This is the part i'm having trouble with
if g(f(i))== False:
print (i)
L.remove(i)
L=[0,-12,-3,-17]
print(applyfg(L, f, g))
print(L)
For some reason I don't understand this line here doesn't seem to apply the functions *correctly. It should apply f an then g to each item in the list to basically remove any that don't return True.
if g(f(i))== False
*incorrectly