24th Apr 2020, 10:21 AM
Jaisuriya
Jaisuriya - avatar
4 Réponses
0
Your question is not clear. Perhaps it's just me.
24th Apr 2020, 10:26 AM
Onyeali David
Onyeali David - avatar
0
What do you want to do?
24th Apr 2020, 10:27 AM
Onyeali David
Onyeali David - avatar
0
Recursivity apply to function call to handle loop without sequential loop construct ('for' and/or 'while' loop), but your code doesn't define any... Based on your code, here is the recursive function I guess you're trying to achieve (with some change as your initial code if applied to a recursive function will never reach it's base case: conversely to infinte sequential loops wich will never ends, "infinite" recursivity never happened, but reach stack/memory limit and end by raising exception ^^ """ # original code a=1 if a>=0: print(a) a+=1 else: print("hh") """ def recursive_function(a=1): if a<=5: print(a) recursive_function(a+1) else: print("hh") recursive_function()
24th Apr 2020, 11:00 PM
visph
visph - avatar
0
Thangs
25th Apr 2020, 4:11 AM
Jaisuriya
Jaisuriya - avatar