0
0
Data Analysis Pythondata~30 mins

Sales data analysis pattern in Data Analysis Python - Mini Project: Build & Apply

Choose your learning style9 modes available
Sales Data Analysis Pattern
📖 Scenario: You work in a small shop that sells three products. Every day, you record how many units of each product you sell. Now, you want to analyze this sales data to find out which products sold more than a certain number of units.
🎯 Goal: Build a simple program that stores daily sales data in a dictionary, sets a sales threshold, finds products that sold more than the threshold, and prints those products with their sales.
📋 What You'll Learn
Create a dictionary called sales with exact product names and sales numbers
Create a variable called threshold to set the minimum sales number
Use a dictionary comprehension to find products with sales greater than threshold
Print the resulting dictionary of filtered products and their sales
💡 Why This Matters
🌍 Real World
Analyzing sales data helps businesses understand which products are popular and make better stock decisions.
💼 Career
Data analysts often filter and summarize sales data to create reports and support business decisions.
Progress0 / 4 steps
1
Create the sales data dictionary
Create a dictionary called sales with these exact entries: 'Apples': 120, 'Bananas': 90, 'Cherries': 150, 'Dates': 60, 'Elderberries': 30.
Data Analysis Python
Hint

Use curly braces {} to create a dictionary. Separate keys and values with a colon :. Separate items with commas.

2
Set the sales threshold
Create a variable called threshold and set it to 80.
Data Analysis Python
Hint

Just assign the number 80 to a variable named threshold.

3
Filter products with sales above threshold
Use a dictionary comprehension to create a new dictionary called top_sellers that contains only products from sales with sales greater than threshold. Use for product, count in sales.items() in your comprehension.
Data Analysis Python
Hint

Use the syntax {key: value for key, value in dict.items() if condition} to filter dictionary items.

4
Print the filtered top sellers
Print the top_sellers dictionary.
Data Analysis Python
Hint

Use print(top_sellers) to display the filtered dictionary.