0
0
Pythonprogramming~15 mins

Boolean values (True and False) in Python - Mini Project: Build & Apply

Choose your learning style9 modes available
Working with Boolean values (True and False)
📖 Scenario: Imagine you are creating a simple system to check if a store is open or closed based on a schedule.
🎯 Goal: You will create a program that uses Boolean values to represent if the store is open or closed, then print the store status.
📋 What You'll Learn
Create a Boolean variable to represent if the store is open
Create a Boolean variable to represent if the store is closed
Use the Boolean variables to check the store status
Print the store status using the Boolean values
💡 Why This Matters
🌍 Real World
Boolean values are used everywhere to represent yes/no, on/off, or true/false conditions in programs.
💼 Career
Understanding Boolean logic is essential for making decisions in software, such as checking if a user is logged in or if a feature is enabled.
Progress0 / 4 steps
1
Create Boolean variables for store status
Create a Boolean variable called store_open and set it to True. Create another Boolean variable called store_closed and set it to False.
Python
Need a hint?

Boolean values are either True or False. Use these to set the variables.

2
Create a variable to hold the store status message
Create a variable called status_message and set it to the string 'Store is open' if store_open is True, otherwise set it to 'Store is closed'.
Python
Need a hint?

Use a simple if-else expression to set status_message based on store_open.

3
Use a Boolean expression to check if the store is closed
Create a variable called is_closed and set it to the result of checking if store_closed is True.
Python
Need a hint?

Compare store_closed to True to get a Boolean result.

4
Print the store status and closed check
Print the status_message variable. Then print the is_closed variable on the next line.
Python
Need a hint?

Use two print statements to show the messages on separate lines.