Question 2
Back to Exercise
What is the output of the following Python program?
from math import factorial as fact, gcd
print(fact(5), gcd(12, 18))
print("math" in dir(), "fact" in dir(), "factorial" in dir())
- A 120 6 True True True
- B 120 6 False True False Correct
- C 120 6 True False True
- D 24 6 False True False
Correct Answer: Option B
Only the names after import (here fact and gcd) are bound – not math, and not the original name factorial.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!