Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to import NumPy with its common alias.
SciPy
import [1] as np
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Importing SciPy instead of NumPy.
Using an incorrect alias.
✗ Incorrect
NumPy is imported using the alias np to simplify code.
2fill in blank
mediumComplete the code to import SciPy's stats module.
SciPy
from scipy import [1]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Importing the wrong SciPy submodule.
Confusing SciPy submodules with NumPy functions.
✗ Incorrect
The stats module in SciPy provides statistical functions.
3fill in blank
hardFix the error in the code to create a NumPy array.
SciPy
arr = np.[1]([1, 2, 3, 4])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'list' which is a Python type, not a NumPy function.
Using 'matrix' which is a different NumPy type.
✗ Incorrect
The correct function to create a NumPy array is array.
4fill in blank
hardFill both blanks to create a SciPy normal distribution and calculate its mean.
SciPy
dist = scipy.stats.[1](loc=0, scale=1) mean_value = dist.[2]()
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'median' or 'mode' instead of 'mean' to get the average.
Using a wrong distribution name.
✗ Incorrect
The normal distribution in SciPy is norm, and its mean is found with mean().
5fill in blank
hardFill all three blanks to create a NumPy array, calculate its mean, and then use SciPy to perform a t-test.
SciPy
import numpy as np from scipy import stats arr = np.[1]([10, 20, 30, 40, 50]) mean_val = np.[2](arr) t_stat, p_val = stats.[3](arr, popmean=30)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'median' instead of 'mean' for average.
Using wrong SciPy test functions.
Not importing SciPy stats module.
✗ Incorrect
We create a NumPy array with array, calculate the mean with mean, and perform a one-sample t-test with SciPy's ttest_1samp.