0
0
NumPydata~15 mins

np.min() and np.max() in NumPy - Mini Project: Build & Apply

Choose your learning style9 modes available
Finding Minimum and Maximum Values with np.min() and np.max()
📖 Scenario: You work at a small fruit store. You have a list of daily sales numbers for apples over a week. You want to find the smallest and largest sales numbers to understand the best and worst days.
🎯 Goal: Learn how to use np.min() and np.max() to find the minimum and maximum values in a list of numbers.
📋 What You'll Learn
Create a NumPy array with exact daily sales numbers
Create a variable to hold the sales data
Use np.min() to find the smallest sales number
Use np.max() to find the largest sales number
Print both minimum and maximum sales values
💡 Why This Matters
🌍 Real World
Stores and businesses often analyze sales data to find their best and worst performing days. This helps them plan stock and promotions.
💼 Career
Data analysts and scientists use functions like <code>np.min()</code> and <code>np.max()</code> to quickly summarize data and find important insights.
Progress0 / 4 steps
1
Create the sales data array
Import NumPy as np and create a NumPy array called sales with these exact values: 23, 45, 12, 67, 34, 89, 10.
NumPy
Need a hint?

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

2
Create variables for minimum and maximum sales
Create two variables: min_sales and max_sales. Use np.min() on sales to get the smallest value and assign it to min_sales. Use np.max() on sales to get the largest value and assign it to max_sales.
NumPy
Need a hint?

Use np.min(sales) and np.max(sales) to find the smallest and largest values.

3
Print the minimum sales value
Write a print statement to display the text "Minimum sales:" followed by the value of min_sales.
NumPy
Need a hint?

Use print("Minimum sales:", min_sales) to show the smallest sales number.

4
Print the maximum sales value
Write a print statement to display the text "Maximum sales:" followed by the value of max_sales.
NumPy
Need a hint?

Use print("Maximum sales:", max_sales) to show the largest sales number.