The following program should print 3 if 0 is given as argument but prints 6.
Not sure if the problem lies in the lambda function or whether the logic is incorrect. Is it the lambda function that is incorrect? Thank you.
def get_list_sum(p, func_list=None):
if func_list is None:
func_list = []
for i in range(3):
func_list.append(lambda x: x + i)
s = 0
for func in func_list:
s += func_list(p)
return s