Quick MCQ — Which SOLID principle says “open for extension, closed for modification”?¶
A) Single Responsibility Principle
B) Open/Closed Principle
C) Interface Segregation Principle
Correct: B — Open/Closed Principle.
Exercises (Pyodide-ready)¶
Add a
LoyaltyDiscountclass that gives 5% off and test replacingNoDiscountwith it.Implement
Loggerto collect logs into a list (instead of printing) and return them for assertion.Sketch (as a markdown cell) how you would split
Orderresponsibilities further to follow SRP more strictly.
SOLID Principles¶
# Your code here