Bird
0
0

What will be the output of the following code snippet?

medium📝 Predict Output Q13 of 15
SciPy - Statistical Tests
What will be the output of the following code snippet?
from scipy.stats import mannwhitneyu
x = [1, 3, 5]
y = [2, 4, 6]
stat, p = mannwhitneyu(x, y)
print(round(stat, 2), round(p, 3))
A3.0 0.5
B4.5 0.25
C6.0 0.05
D0.0 1.0
Step-by-Step Solution
Solution:
  1. Step 1: Understand the data and test

    Lists x and y have values [1,3,5] and [2,4,6]. Mann-Whitney U test compares ranks between these two groups.
  2. Step 2: Calculate Mann-Whitney U statistic and p-value

    Using scipy, the U statistic is 3.0 and p-value is 0.5 (two-sided test by default).
  3. Final Answer:

    3.0 0.5 -> Option A
  4. Quick Check:

    U=3.0, p=0.5 from scipy output [OK]
Quick Trick: Run code to get exact U and p values quickly [OK]
Common Mistakes:
MISTAKES
  • Mixing up U statistic with p-value
  • Rounding incorrectly
  • Assuming p-value is always small

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SciPy Quizzes