Section 1. Chapter 14
single
Challenge: Build a Simple Metrics Dashboard
Swipe to show menu
Task
Swipe to start coding
Task: Business Metrics Dashboard
Create a function print_metrics_dashboard(df) that accepts a DataFrame with sales, conversions, and visits columns and prints a formatted summary of key business metrics.
- Calculate total sales — the sum of the
salescolumn - Calculate average order value — the mean of the
salescolumn - Calculate conversion rate — the sum of
conversionsdivided by the sum ofvisits, multiplied by 100
The printed output must include:
- A header line:
=== Metrics Dashboard === - Total sales formatted as:
Total Sales: $X,XXX.XX - Average order value formatted as:
Average Order Value: $X,XXX.XX - Conversion rate formatted as:
Conversion Rate: XX.XX%
Solution
Everything was clear?
Thanks for your feedback!
Section 1. Chapter 14
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat