0

Why is the value of n (when printing n1:{n} after the r(lst,n-1) becomes 2 and not 1?what happens when the function do return?

def r(lst,n): print(f"nn:{n}") if (n <= 1): return r( lst, n-1) print(f"n1:{n}") r([12,14,13,11,16,10],6)

9th Jul 2023, 1:40 PM
Azalea
1 ответ
+ 3
When the function hits the return, it ends.
9th Jul 2023, 6:35 PM
Ausgrindtube
Ausgrindtube - avatar