Order with OrderLines
Challenge on lesson: Checkpoint: Domain Modeling
CHALLENGE
Difficulty: intermediate+25 XP
Define a dataclass OrderLine(sku, quantity, unit_price) and a class Order that starts empty. add_line(sku, quantity, unit_price) appends an OrderLine and returns the line count (raise ValueError if quantity <= 0). total() sums quantity * unit_price. repr(Order()) must contain 'Order'.
Press Submit to check your solution.
Back to lesson: Checkpoint: Domain Modeling