0
0
Data Analysis Pythondata~15 mins

Aggregation functions (sum, mean, count) in Data Analysis Python - Mini Project: Build & Apply

Choose your learning style9 modes available
Aggregation functions (sum, mean, count)
📖 Scenario: You work in a small store and want to analyze daily sales data to understand how much money you made, the average sale amount, and how many sales you had.
🎯 Goal: Build a simple Python program that uses aggregation functions sum, mean, and count to analyze sales data stored in a list.
📋 What You'll Learn
Create a list of sales amounts
Create a variable to count the number of sales
Calculate the total sales using sum
Calculate the average sale amount using mean
Print the total sales, average sale, and count of sales
💡 Why This Matters
🌍 Real World
Stores and businesses often analyze sales data to understand performance and make decisions.
💼 Career
Data analysts use aggregation functions like sum, mean, and count to summarize data quickly and clearly.
Progress0 / 4 steps
1
Create the sales data list
Create a list called sales with these exact values: 100, 250, 75, 300, 150.
Data Analysis Python
Hint

Use square brackets [] to create a list and separate numbers with commas.

2
Count the number of sales
Create a variable called count_sales and set it to the number of items in the sales list using the len() function.
Data Analysis Python
Hint

Use len(sales) to get the number of sales.

3
Calculate total and average sales
Create a variable called total_sales and set it to the sum of the sales list using the sum() function. Then create a variable called average_sale and set it to total_sales divided by count_sales.
Data Analysis Python
Hint

Use sum(sales) to add all sales. Then divide by count_sales to get the average.

4
Print the results
Print the values of total_sales, average_sale, and count_sales each on a new line.
Data Analysis Python
Hint

Use three print() statements, one for each variable.