0
0
Pythonprogramming~15 mins

Python Block Structure and Indentation - Mini Project: Build & Apply

Choose your learning style9 modes available
Python Block Structure and Indentation
📖 Scenario: You are helping a small bakery keep track of daily sales and decide if they met their sales goal.
🎯 Goal: Build a simple Python program that uses indentation and blocks correctly to check if the bakery met its sales goal and print a message.
📋 What You'll Learn
Create a variable with the total sales amount.
Create a variable with the sales goal amount.
Use an if-else block with correct indentation to compare sales and goal.
Print a message depending on whether the goal was met or not.
💡 Why This Matters
🌍 Real World
Businesses often use simple programs like this to check if they met daily targets and decide next steps.
💼 Career
Understanding Python block structure and indentation is essential for writing clear, error-free code in any programming job.
Progress0 / 4 steps
1
Create the sales data variable
Create a variable called total_sales and set it to 1200 to represent the bakery's total sales for the day.
Python
Need a hint?

Use the equals sign = to assign the value 1200 to the variable total_sales.

2
Set the sales goal
Create a variable called sales_goal and set it to 1000 to represent the bakery's sales target for the day.
Python
Need a hint?

Remember to use a new line and assign 1000 to sales_goal.

3
Write the if-else block to check sales
Write an if statement to check if total_sales is greater than or equal to sales_goal. Use a colon : and indent the next line. Inside the if block, write message = "Goal met! Great job!". Then write an else block with the same indentation as if, and inside it write message = "Goal not met. Keep trying!" indented properly.
Python
Need a hint?

Remember to indent the lines inside the if and else blocks by 4 spaces.

4
Print the result message
Write a print statement to display the value of the message variable.
Python
Need a hint?

Use print(message) to show the message on the screen.