Q. What is the problem in the following piece of code ?


from math import factorial

print (math.factorial (5))


Answer :-

In the "from-import" form of import, the imported identifiers (in this case factorial()) become part of the current local namespace and hence their module's names aren't specified along with the module name. Thus, the statement should be:


print (factorial (5))

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post