5.4.3. Homework#
Use this assignment to practice the chapter’s concepts and coding skills in runnable Python code.
Sign in from the account menu before you start working on the assignment.
Write and run your code directly in the coding cells.
Multiple submissions are allowed. The highest score is kept.
1. Chart Choice
A manager comparing revenue across regions would usually start with a comparison chart such as a bar chart.
2. Line Charts
A line chart is usually appropriate when the business question focuses on change over time.
3. Scatterplots
A scatterplot is mainly used to show the parts of a whole, so it is the default choice for market share percentages.
4. Outliers
A chart can reveal an unusual sales value that should be investigated before a report is finalized.
5. Labels
Removing axis labels usually makes a chart easier for a business audience to interpret.
### 6. Chart Recommendation Count
# Count how many questions should use each chart type.
# Print exactly:
# Bar charts: 2
# Line charts: 1
chart_choices = ["bar", "line", "bar", "scatter"]
### Your code starts here.
### Your code ends here.
Bar charts: 2
Line charts: 1
### 7. Axis Range
# Calculate the range needed for the y-axis values.
# Print exactly:
# Minimum sales: 80
# Maximum sales: 140
sales = [95, 120, 80, 140]
### Your code starts here.
### Your code ends here.
Minimum sales: 80
Maximum sales: 140
### 8. Scatter Pairs
# Pair ad spending and revenue values for a scatterplot.
# Print exactly:
# First pair: [10, 80]
# Pair count: 3
ad_spend = [10, 15, 20]
revenue = [80, 110, 150]
### Your code starts here.
### Your code ends here.
First pair: [10, 80]
Pair count: 3
### 9. Emphasis Color
# Choose a highlight color for the target region and gray for the others.
# Print exactly:
# Colors: ['gray', 'red', 'gray']
regions = ["East", "West", "South"]
target_region = "West"
### Your code starts here.
### Your code ends here.
Colors: ['gray', 'red', 'gray']
### 10. Misleading Scale Flag
# Flag the chart if the y-axis does not start at zero for a bar chart.
# Print exactly:
# Scale warning: True
chart_type = "bar"
y_axis_start = 75
### Your code starts here.
### Your code ends here.
Scale warning: True