5.4.2. Lab#
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.
### Question 1: Choose a Chart Type
# Choose chart types for three management questions.
# Use the words line, bar, and scatter.
# Print exactly:
# Trend chart: line
# Comparison chart: bar
# Relationship chart: scatter
questions = ["monthly revenue trend", "regional sales comparison", "price and demand relationship"]
### Your code starts here.
### Your code ends here.
Trend chart: line
Comparison chart: bar
Relationship chart: scatter
### Question 2: Prepare Plot Data
# Pair each month with its revenue for plotting.
# Store the pairs in plot_points.
# Print exactly:
# First point: Jan 120
# Last point: Mar 150
months = ["Jan", "Feb", "Mar"]
revenue = [120, 135, 150]
### Your code starts here.
### Your code ends here.
First point: Jan 120
Last point: Mar 150
### Question 3: Histogram Bins
# Count survey scores into low, medium, and high bins.
# Low is below 4, medium is 4 through 7, and high is above 7.
# Print exactly:
# Low: 2
# Medium: 4
# High: 2
scores = [2, 4, 6, 8, 7, 3, 9, 5]
### Your code starts here.
### Your code ends here.
Low: 2
Medium: 4
High: 2
### Question 4: Bar Chart Labels
# Build labels for a bar chart from region names and sales values.
# Store them in chart_labels.
# Print exactly:
# Chart title: Sales by Region
# First label: East: 240
regions = ["East", "West", "South"]
sales = [240, 210, 180]
### Your code starts here.
### Your code ends here.
Chart title: Sales by Region
First label: East: 240
### Question 5: Identify Outliers
# Find values that are far above the rest of the monthly counts.
# Treat values greater than 100 as outliers.
# Print exactly:
# Regular count: 5
# Outliers: [210]
counts = [42, 38, 45, 41, 39, 210]
### Your code starts here.
### Your code ends here.
Regular count: 5
Outliers: [210]
Question 1
Question 2
Question 3
Question 4
Question 5