0
0
Data Analysis Pythondata~20 mins

Descriptive statistics review in Data Analysis Python - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Descriptive Statistics Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
Calculate mean and median from a list
What is the output of the following code that calculates the mean and median of a list of numbers?
Data Analysis Python
import statistics
numbers = [10, 20, 30, 40, 50]
mean_val = statistics.mean(numbers)
median_val = statistics.median(numbers)
print(mean_val, median_val)
A30 25
B30 20
C25 30
D30.0 30.0
Attempts:
2 left
💡 Hint
Mean is the average, median is the middle value when sorted.
data_output
intermediate
2:00remaining
Count unique values in a DataFrame column
Given a DataFrame with a column of colors, what is the output of counting unique values in that column?
Data Analysis Python
import pandas as pd
data = {'color': ['red', 'blue', 'red', 'green', 'blue', 'blue']}
df = pd.DataFrame(data)
unique_counts = df['color'].value_counts()
print(unique_counts)
A
green   3
red     2
blue    1
Name: color, dtype: int64
B
red     3
blue    2
green   1
Name: color, dtype: int64
C
blue    3
red     2
green   1
Name: color, dtype: int64
D
blue    2
red     2
green   2
Name: color, dtype: int64
Attempts:
2 left
💡 Hint
Count how many times each color appears.
visualization
advanced
3:00remaining
Identify the correct boxplot visualization
Which option shows the correct boxplot for the data [5, 7, 8, 12, 15, 18, 22]?
Data Analysis Python
import matplotlib.pyplot as plt
data = [5, 7, 8, 12, 15, 18, 22]
plt.boxplot(data)
plt.show()
ABoxplot with median line near 8, whiskers from 5 to 15, no outliers
BBoxplot with median line near 12, whiskers from 5 to 22, no outliers
CBoxplot with median line near 15, whiskers from 7 to 18, outliers at 5 and 22
DBoxplot with median line near 12, whiskers from 7 to 22, outlier at 5
Attempts:
2 left
💡 Hint
Median is the middle value; whiskers cover min and max if no outliers.
🧠 Conceptual
advanced
1:30remaining
Understanding standard deviation effect
If two datasets have the same mean but one has a larger standard deviation, what does this mean about the data?
AThe dataset with larger standard deviation has values more spread out from the mean
BThe dataset with larger standard deviation has values closer to the mean
CBoth datasets have identical value distributions
DStandard deviation does not relate to data spread
Attempts:
2 left
💡 Hint
Think about how spread out the numbers are around the average.
🔧 Debug
expert
2:00remaining
Identify the error in variance calculation code
What error does the following code raise when calculating variance of a list?
Data Analysis Python
data = [4, 8, 15, 16, 23, 42]
variance = sum((x - sum(data)/len(data))**2 for x in data) / (len(data) - 1)
print(variance)
ANo error, prints correct variance value
BZeroDivisionError because len(data) - 1 is zero
CTypeError because sum() is used incorrectly
DNameError because variable 'variance' is not defined
Attempts:
2 left
💡 Hint
Check if denominator is zero and if sum() is used correctly.