0
0
Pythonprogramming~15 mins

Assignment and augmented assignment in Python - Mini Project: Build & Apply

Choose your learning style9 modes available
Assignment and Augmented Assignment
📖 Scenario: You are managing a small shop's daily sales. You want to keep track of the total sales amount as you add new sales throughout the day.
🎯 Goal: Build a simple program that starts with an initial sales amount, then adds more sales using assignment and augmented assignment operators, and finally shows the total sales.
📋 What You'll Learn
Create a variable to hold the initial sales amount.
Create a variable to hold the new sales amount.
Use an assignment operator to set the initial total sales.
Use an augmented assignment operator to add new sales to the total.
Print the final total sales amount.
💡 Why This Matters
🌍 Real World
Tracking sales or any running total is common in shops, restaurants, and many businesses.
💼 Career
Understanding assignment and augmented assignment is essential for managing data and calculations in programming jobs.
Progress0 / 4 steps
1
Create initial sales variables
Create a variable called initial_sales and set it to 150. Then create a variable called new_sales and set it to 75.
Python
Need a hint?

Use simple assignment with = to set the values.

2
Set total sales with assignment
Create a variable called total_sales and assign it the value of initial_sales using the assignment operator =.
Python
Need a hint?

Use = to copy the value from initial_sales to total_sales.

3
Add new sales using augmented assignment
Use the augmented assignment operator += to add new_sales to total_sales.
Python
Need a hint?

The += operator adds the right side value to the left side variable.

4
Print the total sales
Write a print statement to display the value of total_sales.
Python
Need a hint?

Use print(total_sales) to show the final total.