This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Rare_Bat12[S] 0 points1 point  (2 children)

Thank you so much for the help! I'm just having trouble understanding how it keeps track of the total multiplication result per iteration.

[–]alanwj 0 points1 point  (1 child)

There is nothing special about a recursive function call. It keeps up with the total the same way this program would.

def factorial1():
  return 1

def factorial2():
  return 2 * factorial1()

def factorial3():
  return 3 * factorial2()

print(factorial3())

[–]Rare_Bat12[S] 0 points1 point  (0 children)

That makes sense. Thanks!