How does one use the factorial command in Python? I have attempted the math.factorial
command, and either I am using it completely incorrectly, or it isn't working and returns the error
NameError: name 'math' is not defined
for some reason.
How does one use the factorial command in Python? I have attempted the math.factorial
command, and either I am using it completely incorrectly, or it isn't working and returns the error
NameError: name 'math' is not defined
for some reason.
You have to import the math module first:
import math
math.factorial(x)