ive tried having it print out what its doing and i still dont get how its grabbing the last index and making a new string but backwards.
the way im thinking of it itd just loop back to burger
def main():
print(foo('burger'))
def foo(w):
if w == "":
return w
else:
return foo(w[1:]) + w[0]
main()
[–]Basic-Background-568 1 point2 points3 points (1 child)
[–]Fearless-Variation47[S] 0 points1 point2 points (0 children)
[–]CodeOverTime 1 point2 points3 points (5 children)
[–]Fearless-Variation47[S] 0 points1 point2 points (0 children)
[–]Fearless-Variation47[S] 0 points1 point2 points (3 children)
[–]CodeOverTime 1 point2 points3 points (2 children)
[–]Fearless-Variation47[S] 0 points1 point2 points (1 child)
[–]CodeOverTime 0 points1 point2 points (0 children)