← Code LabPython0/50 solved · 0%
OOP · hard

49. Structural typing with Protocol

Duck typing checked statically.

Write a `typing.Protocol` named `Priceable` requiring a `price(self) -> float` method, and a function `total_price(items)` that sums `.price()` across any objects, regardless of their concrete class.
Required in your answer: Protocoldef total_price