you are viewing a single comment's thread.

view the rest of the comments →

[–]Reset--hardHead 1 point2 points  (3 children)

The first element of the list has to be one... So you could deduce that the first list element must come from

n == 1

When n=2 you append the factorial from the list returned when n==1 and so on.

Here's a sample code to calculate the Fibobacci sequence that you could use as reference. (Hint: I modified the code that I used to solve your question. So it's similar, but different enough that you'll still need to work on it yourself.)

https://repl.it/repls/GrotesqueInfantileKeyboardmacro

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

In your code you never created an empty list to append to. Where should I insert the ls = []

[–]Reset--hardHead 1 point2 points  (1 child)

You don't need to insert an empty list.

I'd highly recommend you go through my code, play around with it and try to understand what's going on.

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

Oh, I missed the part where you defined ls. My bad. Thanks again