Skip to main content

Practice ยท 3 of 3

Typed Payload

Define a TypedDict ProductDict with keys sku: str and price: float. Then implement total_price(items: list[ProductDict]) -> float summing prices. get_type_hints(ProductDict) must show both annotations.

Difficulty: intermediate

Back to lesson: Practice: Annotation Drills