Lessons 6–10 · About 60 min per lesson
Decisions
Express approvals, waits and restock alerts as clear rules.
Lesson breakdown
- Lesson 6
Compare available stock with demand and test the equality case.
- Lesson 7
Use if and else to print two possible results and inspect how indentation controls each branch.
- Lesson 8
Use elif to write three stock alerts and check the order of thresholds.
- Lesson 9
Combine conditions with and, or and not, and trace several truth values.
- Lesson 10
Test the branches with inputs just below, at and above the boundary.
Worked example
Stock is 7 kg. A request for 5 kg prints Enough. What does a request for exactly 7 kg print?
How to solve it
Both print Enough. Stock that equals demand can fill the request, so use >=.
stock = int(input())
request = int(input())
if stock >= request:
print("Enough")
else:
print("Wait")Assignment
Write a stock alert: print Empty at 0, Low for 1–4 and Ready for 5 or more.
Check your result
0 → Empty; 4 → Low; 5 → Ready.