it suppose to be function composition. I think that the problem is when there is only one function left in funcs. I wanted it to be an empty tuple but it didn't recognize it like that and enters an infinity loop
Thank you! :)
def compose(*funcs):
if len(funcs)==0:
return lambda x:x
f=funcs[0]
return lambda x: f(compose(funcs[1:])(x))