0
0
ML Pythonprogramming~10 mins

Data distributions and outliers in ML Python - Interactive Code Practice

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

Complete the code to calculate the mean of the data list.

ML Python
mean_value = sum(data) / [1]
Drag options to blanks, or click blank then click option'
Amax(data)
Bsum(data)
Clen(data)
Dmin(data)
Attempts:
3 left
2fill in blank
medium

Complete the code to calculate the median of a sorted list named sorted_data.

ML Python
mid_index = len(sorted_data) // 2
median = sorted_data[[1]] if len(sorted_data) % 2 != 0 else (sorted_data[mid_index - 1] + sorted_data[mid_index]) / 2
Drag options to blanks, or click blank then click option'
Amid_index
B0
Clen(sorted_data)
Dmid_index + 1
Attempts:
3 left
3fill in blank
hard

Fix the error in the code to detect outliers using the interquartile range (IQR).

ML Python
iqr = q3 - q1
lower_bound = q1 - 1.5 * [1]
upper_bound = q3 + 1.5 * iqr
outliers = [x for x in data if x < lower_bound or x > upper_bound]
Drag options to blanks, or click blank then click option'
Aiqr
Bq1
Cq3
Dmean
Attempts:
3 left
4fill in blank
hard

Fill both blanks to create a dictionary of word lengths for words longer than 3 characters.

ML Python
lengths = {word: [1] for word in words if len(word) [2] 3}
Drag options to blanks, or click blank then click option'
Alen(word)
B>
C<
Dword
Attempts:
3 left
5fill in blank
hard

Fill all three blanks to create a dictionary of uppercase words and their lengths for words longer than 4 characters.

ML Python
result = { [1]: [2] for w in words if len(w) [3] 4}
Drag options to blanks, or click blank then click option'
Aw.upper()
Blen(w)
C>
Dw
Attempts:
3 left