Here x is not local to the lambda but is defined outside the scope and is only accessed when the lambda is called rather than when defined. At the end of the loop, the value of x is 4 and hence returns only 16 for all values.
save the values in variables local to the lambdas. something like this:
squares = []
for x in range(5):
squares.append(lambda n=x: n**2)