Happy Hour Discount Windows

Medium ⏱ 12 min 46% acceptance ★★★★☆ 4.3
Orders placed 15:00-18:59 get 30% off food (category 'food'), never beverages. Write bill(orders) where each order is (hour, category, amount): total the payable amount, applying the window discount to qualifying lines, 2-decimal rounded at the end.

Examples

Example 1
Input
bill([(16, 'food', 400), (16, 'beverage', 200), (20, 'food', 300)])
Output
780.0
Explanation

400 → 280 in the window; the rest full price.

Constraints

  • Window is 15 ≤ hour < 19.
  • Beverages never discount.

Topics

Business Logictime-based pricing

Companies

ZomatoDineoutHungerBox

Hints

Hint 1

A per-line multiplier expression works in a comprehension.

Hint 2

Round the sum once.

Loading the Python runtime… Run executes your code and shows printed output; Submit checks your function against this problem's examples.