I'm on exercise 1.5 of Practice Makes Perfect, called "factorial". Here is my code and corresponding understandings:
def factorial(x): factors =  while x>0: factors.append(x) x = x-1 print factors
To get the factors of some number
x, I created an empty list called
factors and while
x>0, I append a number to that list then subtract one and repeat. The list
factors successfully prints all the factors of a number. I'm just stuck on how to now multiply them all together. My intuition is to add a
for loop to iterate through all the numbers in my list and multiply them together, I'm just confused as to how to accomplish this?