Complete the code to calculate the mean of the data list.
mean_value = sum(data) / [1]
The mean is the sum of all values divided by the number of values, which is given by len(data).
Complete the code to calculate the median of a sorted list named sorted_data.
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
The median for an odd-length list is the middle element at index mid_index.
Fix the error in the code to detect outliers using the interquartile range (IQR).
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]
The IQR is used to calculate the bounds for outliers, so multiply 1.5 by iqr.
Fill both blanks to create a dictionary of word lengths for words longer than 3 characters.
lengths = {word: [1] for word in words if len(word) [2] 3}< instead of greater than.We want the length of each word, so use len(word), and filter words longer than 3 using >.
Fill all three blanks to create a dictionary of uppercase words and their lengths for words longer than 4 characters.
result = { [1]: [2] for w in words if len(w) [3] 4}< instead of greater than.The keys are uppercase words using w.upper(), values are lengths with len(w), and filter words longer than 4 with >.
