0
0
NumPydata~30 mins

Why statistics with NumPy matters - See It in Action

Choose your learning style9 modes available
Why statistics with NumPy matters
📖 Scenario: Imagine you run a small bakery. You want to understand how many cakes you sell each day to plan better. You have sales numbers for a week and want to find the average, the smallest, and the biggest sales day.
🎯 Goal: You will use NumPy to calculate basic statistics like mean, minimum, and maximum from your sales data. This helps you see patterns and make smart decisions.
📋 What You'll Learn
Create a NumPy array with exact daily sales numbers
Create a variable to hold the sales data
Use NumPy functions to find mean, min, and max
Print the results clearly
💡 Why This Matters
🌍 Real World
Businesses use statistics to understand sales trends and plan inventory or marketing.
💼 Career
Data analysts and scientists use NumPy daily to analyze data quickly and accurately.
Progress0 / 4 steps
1
Create the sales data array
Import NumPy as np and create a NumPy array called sales with these exact daily sales numbers: 20, 35, 30, 35, 27, 25, 40.
NumPy
Need a hint?

Use np.array() to create the array with the exact sales numbers.

2
Calculate the average sales
Create a variable called average_sales and use np.mean() on the sales array to find the average number of cakes sold.
NumPy
Need a hint?

Use np.mean(sales) to get the average.

3
Find the minimum and maximum sales
Create two variables called min_sales and max_sales. Use np.min() on sales to find the smallest sales number and np.max() on sales to find the biggest sales number.
NumPy
Need a hint?

Use np.min(sales) and np.max(sales) to find smallest and biggest sales.

4
Print the statistics
Print the values of average_sales, min_sales, and max_sales with clear messages. Use three separate print() statements.
NumPy
Need a hint?

Use print(f"Average sales: {average_sales}") style to show results clearly.