I am trying to generate a list of functions in python3
l=[lambda r: r+i for i in range(3)]
l[0](1) #=3
l[1](1) #=3
l[2](1) #=3
However, when I am using the code above I always get the same result. It seems like the function is always the one i created last. In this case lambda r: r+2
Any idea how I could generate a list of functions is appreciated.