0
0
SciPydata~10 mins

Mann-Whitney U test in SciPy - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the Mann-Whitney U test function from scipy.stats.

SciPy
from scipy.stats import [1]
Drag options to blanks, or click blank then click option'
Amann_whitney_u
Bmannu
Cmann_whitney
Dmannwhitneyu
Attempts:
3 left
💡 Hint
Common Mistakes
Using underscores in the function name like 'mann_whitney_u'.
Capitalizing parts of the function name.
2fill in blank
medium

Complete the code to perform the Mann-Whitney U test on two samples, sample1 and sample2.

SciPy
stat, p = mannwhitneyu([1], sample2)
Drag options to blanks, or click blank then click option'
Asample1
Bsample3
Cdata1
Dvalues1
Attempts:
3 left
💡 Hint
Common Mistakes
Using a variable name not defined in the context.
Swapping the order of samples incorrectly.
3fill in blank
hard

Fix the error in the code to correctly perform a two-sided Mann-Whitney U test.

SciPy
stat, p = mannwhitneyu(sample1, sample2, alternative=[1])
Drag options to blanks, or click blank then click option'
A'greater'
B'two_sided'
C'two-sided'
D'two_sided_test'
Attempts:
3 left
💡 Hint
Common Mistakes
Using underscores instead of hyphens in 'two-sided'.
Using invalid strings like 'two_sided_test'.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps each word to its length if the length is greater than 3.

SciPy
{word: [1] for word in words if [2]
Drag options to blanks, or click blank then click option'
Alen(word)
Bword
Clen(word) > 3
Dword > 3
Attempts:
3 left
💡 Hint
Common Mistakes
Using the word itself as the value instead of its length.
Comparing the word string directly to a number.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps each uppercase word to its length if the length is greater than 4.

SciPy
{ [1]: [2] for word in words if [3] }
Drag options to blanks, or click blank then click option'
Aword.upper()
Blen(word)
Clen(word) > 4
Dword.lower()
Attempts:
3 left
💡 Hint
Common Mistakes
Using word.lower() instead of uppercase for keys.
Using the word itself as the value instead of its length.
Incorrect condition like word > 4.