def factorial(x):
for number in x:
while x > 0:
total = 1
return total == total * x
x = x - 1
return total

"Oops, try again. factorial(1) resulted in an error: 'int' object is not iterable"

I can't figure out why this doesn't work... not sure what I'm not seeing!


Have you read the error message? Have you understood it? Look at it carefully, it isn't very cryptic and it's telling you what's wrong.

Also, I think you'll have a hard time motivating why you would need or even have use for, two loops in computing the factorial of a number


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.