0
0
SciPydata~10 mins

Descriptive statistics (describe) 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 function that calculates descriptive statistics.

SciPy
from scipy.stats import [1]
data = [1, 2, 3, 4, 5]
result = describe(data)
print(result)
Drag options to blanks, or click blank then click option'
Adescribe
Bmode
Cmedian
Dmean
Attempts:
3 left
💡 Hint
Common Mistakes
Importing mean or median instead of describe.
Forgetting to import from scipy.stats.
2fill in blank
medium

Complete the code to calculate descriptive statistics for the given data list.

SciPy
from scipy.stats import describe
data = [10, 20, 30, 40, 50]
result = describe([1])
print(result)
Drag options to blanks, or click blank then click option'
A[1, 2, 3]
Brange(5)
Clist
Ddata
Attempts:
3 left
💡 Hint
Common Mistakes
Passing a range object instead of the data list.
Passing the word 'list' instead of the variable.
3fill in blank
hard

Fix the error in the code to correctly calculate descriptive statistics.

SciPy
from scipy.stats import describe
data = [5, 10, 15, 20]
result = describe([1])
print(result)
Drag options to blanks, or click blank then click option'
Adata
Bdata.values
Cdata.tolist()
Ddata.items()
Attempts:
3 left
💡 Hint
Common Mistakes
Trying to use values or items on a list.
Passing a method call instead of the list variable.
4fill in blank
hard

Fill both blanks to create a dictionary of descriptive statistics for words longer than 3 letters.

SciPy
words = ['data', 'science', 'is', 'fun']
lengths = {word: [1] for word in words if len(word) [2] 3}
print(lengths)
Drag options to blanks, or click blank then click option'
Alen(word)
B>
C<
Dword
Attempts:
3 left
💡 Hint
Common Mistakes
Using the word itself as value instead of its length.
Using less than instead of greater than in the condition.
5fill in blank
hard

Fill all three blanks to create a filtered dictionary with uppercase keys and values greater than 2.

SciPy
data = {'a': 1, 'b': 3, 'c': 5}
filtered = {{ [1]: [2] for k, v in data.items() if v [3] 2 }}
print(filtered)
Drag options to blanks, or click blank then click option'
Ak.upper()
Bv
C>
Dk.lower()
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase keys instead of uppercase.
Using wrong comparison operator in filter.
Swapping keys and values in dictionary comprehension.