निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
What will be the output of the following Python code ?
from math import factorial
print(math.factorial(5))
A)
B)
C)
D)
Explanation:
In the code, you imported the factorial
function directly, but then tried to use it with math.factorial(5)
. Since you didn't import math
fully, you can't use math.factorial()
.
The correct code would be:
from math import factorial
print(factorial(5))
So, the error happens because of the incorrect use of math.factorial
.
Answer: (D) Error, the statement should be: print(factorial(5)).