0
0
Pythonprogramming~15 mins

Arithmetic operators in Python - Mini Project: Build & Apply

Choose your learning style9 modes available
Arithmetic Operators Practice
📖 Scenario: You are helping a small shop owner calculate prices and discounts for items sold.
🎯 Goal: Build a simple program that uses arithmetic operators to calculate the total price, discount amount, and final price after discount.
📋 What You'll Learn
Create variables for item price and quantity
Create a variable for discount rate
Calculate total price using multiplication
Calculate discount amount using multiplication
Calculate final price by subtracting discount from total price
Print the final price
💡 Why This Matters
🌍 Real World
Calculating prices and discounts is common in shopping and billing systems.
💼 Career
Understanding arithmetic operators is essential for programming tasks involving calculations, finance, and data processing.
Progress0 / 4 steps
1
Create item price and quantity variables
Create a variable called item_price and set it to 20. Create another variable called quantity and set it to 3.
Python
Need a hint?

Use the assignment operator = to set values.

2
Create discount rate variable
Create a variable called discount_rate and set it to 0.1 (which means 10%).
Python
Need a hint?

Remember that 10% as a decimal is 0.1.

3
Calculate total price, discount amount, and final price
Calculate the total price by multiplying item_price and quantity and store it in total_price. Calculate the discount amount by multiplying total_price and discount_rate and store it in discount_amount. Calculate the final price by subtracting discount_amount from total_price and store it in final_price.
Python
Need a hint?

Use * for multiplication and - for subtraction.

4
Print the final price
Write a print statement to display the value of final_price.
Python
Need a hint?

Use print(final_price) to show the result.