python - Factorial code does not return product of integer and all integers before it - Stack Overflow

PHOTO EMBED

Tue Feb 06 2024 06:22:51 GMT+0000 (Coordinated Universal Time)

Saved by @Mad_Hatter #python #forloops

def factorial(n):
    result = 1
    for x in range(0,10):
        result = result * x
    return x

for n in range(0,10):
  print(n, n*factorial(n+1))
content_copyCOPY

Google python crash course

https://stackoverflow.com/questions/60689743/factorial-code-does-not-return-product-of-integer-and-all-integers-before-it