Need some help with this code, can't figure the lambda syntax right here:
def func(m,n):
if m < n:
return ____
elif m==n:
return ____
else:
return ____
input:
func(3,10)()()()()()()
func(3,7)()()()
func(4,4)()
func(10,5)()()
func(9,5)()()
output should be:
13
m==n
m==n
15
14
I've tried:
def func(m, n):
if m < n:
return lambda: func(m+1, n-1)
elif m == n:
return lambda: print("m == n")
else:
return lambda: print(n+m)
This function works without errors with main like that:
func(3,10)()()()()() # ()
func(3,7)()()()
func(4,4)()
func(10,5)() # ()
func(9,5)() # ()
There is a way to make it work with the commented brackets?