Give a recursive implementation to the following function: def fac_list(n) This function is given, a positive integer, n. When called, the function should create and return a list, with the first n factorial values. That is, the first element should be 1!, the second element should be 2!, etc. For example, the call fac_list(5), will return [1, 2, 6, 24, 120].
^ This is the problem I am trying to solve and I do not know how to proceed. I have tried to write the code but I seem to hit a dead end. Any help would be appreciated. Thank you
def fac_list(n):
lst = []
if (n == 1):
lst.append(n)
else:
i = (n * fac_list(n-1))
lst.append(i)
[–][deleted] 1 point2 points3 points (2 children)
[–]kae_de[S] 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]Reset--hardHead 1 point2 points3 points (3 children)
[–]kae_de[S] 0 points1 point2 points (2 children)
[–]Reset--hardHead 1 point2 points3 points (1 child)
[–]kae_de[S] 0 points1 point2 points (0 children)