As a sort of supplement but with code that is highly improbable in its present form except for demonstration and study, here is an implementation of the above...
return lambda x: x % 2 == 0
def fn2(is_even, r):
return list(filter(is_even, range(r)))
return list(map(lambda x: x + 1, evens))
r = 21
s = fn1()
t = fn2(s,r)
u = fn3(t)
done = 0
for b in u,s,t:
done += 1
if done == 3:
[0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20]
[1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21]
No, I did not conceive of the loop(s) although I certainly recognized the potential on first glance at the code I stole them from, The forest example from the Turtle samples in IDLE. I just thought it was so cool that we could iterate through a list of variables that are themselves tied to one or multiple functions. It bears further study, that's for sure. But, don't let it scare you or interfere with your track studies here. This is just a sidebar.