+ 4
Func
def func(level): if level==1: return 1 else: return level+func(level-1) print(func(5)) level - is argument? Can somebody explain me how it works? after ELSE what it do level+func...? thank you!
2 Answers
+ 2
Thank you very much!
+ 2
This type of methods are called recursive methods. Learn more here!
https://www.tutorialspoint.com/data_structures_algorithms/recursion_basics.htm