Report Bug

Qus

What will be the output of the following Python code?

from math import factorial
print(math.factorial(5))
Qus

निम्नलिखित पायथन कोड का आउटपुट क्या होगा?

from math import factorial
print(math.factorial(5))


A. 120
B. Nothing is printed
C. NameError: name 'math' is not defined
D. Error, the statement should be print factorial(5))


Solution
C. NameError: name 'math' is not defined



Explanation
from math import factorial
print(factorial(5))
gives the result 120 , when we use from keyword to import a particular function then we can not use module name as prefix in function.
CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online Exam Quiz O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Best Website and Software Company in Allahabad Website development Company in Allahabad