Bird
0
0

Identify the error in this Mann-Whitney U test code and select the fix:

medium📝 Debug Q14 of 15
SciPy - Statistical Tests
Identify the error in this Mann-Whitney U test code and select the fix:
from scipy.stats import mannwhitneyu
x = [1, 2, 3]
y = [4, 5, 6]
stat, p = mannwhitneyu(x, y, alternative='greater')
print(stat, p)
AReplace mannwhitneyu with mann_whitney_u
BChange 'alternative' to 'two-sided'
CNo error; code runs correctly
DUse 'alternative="greater"' with capital G
Step-by-Step Solution
Solution:
  1. Step 1: Check function parameters

    The mannwhitneyu function accepts an alternative parameter with values 'two-sided', 'less', or 'greater'.
  2. Step 2: Verify code correctness

    Using alternative='greater' is valid and the function call is correct.
  3. Final Answer:

    No error; code runs correctly -> Option C
  4. Quick Check:

    Correct parameter usage = D [OK]
Quick Trick: Check scipy docs for valid 'alternative' values [OK]
Common Mistakes:
MISTAKES
  • Using wrong alternative string case
  • Trying to use non-existent function names
  • Assuming default alternative is 'greater'

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SciPy Quizzes