Apr-13-2020, 11:37 AM
So basically i am having trouble with the following Code. Whenever i run it, in the 3rd iteration the programm throws a RecursionError.
The error occurs in the 3rd last line (value=a(b(100)) and if i delete that one and the following line it works.
The error is not caused by the while-loop being iterated too many times.
Thanks in advance for your responses.
lst=[[]] while len(lst)<10: lst.append([]) lst[-1].append(lambda x: x+5) for i in range(1, int(len(lst)/2+0.5)): for a in lst[i]: for b in lst[-1-i]: value1=a(b(100)) if value1>0 and value1%1==0: lst[-1].append(lambda x: a(b(x)))I copied this out of a project and i just need to understand, why it doesn't work or how i can fix it. In the project the lambda function adds, subtracts, divides and multiplies the x value, hence the if-statement.
The error occurs in the 3rd last line (value=a(b(100)) and if i delete that one and the following line it works.
The error is not caused by the while-loop being iterated too many times.
Thanks in advance for your responses.