0
0
Pythonprogramming~15 mins

max() and min() in Python - Mini Project: Build & Apply

Choose your learning style9 modes available
Finding Maximum and Minimum Values with max() and min()
๐Ÿ“– Scenario: You work in a small store and want to find the most expensive and cheapest items in your product list.
๐ŸŽฏ Goal: Build a simple program that finds the maximum and minimum prices from a list of product prices using max() and min().
๐Ÿ“‹ What You'll Learn
Create a list of product prices
Create variables to hold the maximum and minimum prices
Use max() and min() functions to find the highest and lowest prices
Print the maximum and minimum prices
๐Ÿ’ก Why This Matters
๐ŸŒ Real World
Stores and businesses often need to find the highest and lowest prices or values quickly to make decisions.
๐Ÿ’ผ Career
Knowing how to use max() and min() helps in data analysis, reporting, and making smart choices in programming jobs.
Progress0 / 4 steps
1
Create a list of product prices
Create a list called prices with these exact values: 15.99, 23.50, 9.99, 5.49, and 12.00.
Python
Need a hint?

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

2
Create variables for max and min prices
Create two variables called max_price and min_price and set both to 0.
Python
Need a hint?

Use simple assignment like variable = 0.

3
Find the maximum and minimum prices using max() and min()
Use the max() function on prices and assign the result to max_price. Then use the min() function on prices and assign the result to min_price.
Python
Need a hint?

Use max_price = max(prices) and min_price = min(prices).

4
Print the maximum and minimum prices
Print the values of max_price and min_price exactly as shown: print(max_price) and print(min_price).
Python
Need a hint?

Use two print statements: print(max_price) and print(min_price).