I was just wondering If my code is good

so I spent maybe an 45 mins on this question lol much stupid.

my initial thought was to arrive at the code at the bottom.

but i gave up because i kept using the "num" INSIDE the loop. which means the num value actually resets each time the loop is done.

I arrived at this slightly long winded way instead. after scratching my head for a while.

```
code 2
def factorial(x):
multiply = []
b = 1
if x == 0 or x == 1:
return 1
else:
multiply.append(x)
while x >= 2 :
y = x - 1
multiply.append(y)
x -= 1
else:
for a in multiply:
b *= a
return b
what I wanted.
def factorial(x):
num = 1
while x >=1:
num = num * x
x -= 1
return num
```