0
Did this correct
4 Respuestas
0
Your question is not clear. Perhaps it's just me.
0
What do you want to do?
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()
0
Thangs