Bird
0
0

What is the output of this code?

medium📝 Predict Output Q4 of 15
SciPy - Constants and Special Functions
What is the output of this code?
from scipy.special import gamma
result = gamma(5)
print(result)
A120.0
B24.0
C5.0
DError: gamma function undefined
Step-by-Step Solution
Solution:
  1. Step 1: Understand gamma function behavior

    The gamma function of n is (n-1)! for positive integers.
  2. Step 2: Calculate gamma(5)

    gamma(5) = 4! = 24.0
  3. Final Answer:

    24.0 -> Option B
  4. Quick Check:

    gamma(5) = 24.0 [OK]
Quick Trick: Gamma(n) = (n-1)! for positive integers [OK]
Common Mistakes:
MISTAKES
  • Confusing gamma(5) with 5!
  • Expecting 120 instead of 24
  • Thinking gamma is undefined for integers

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SciPy Quizzes