Skip to content
← Back to the archive

25 August 2026

Coupon Prices

Easy Lists

Apply the same coupon to every price without creating negative prices.

You are given a list of whole-number prices and one coupon amount. For each price: - subtract the coupon - never return less than 0 - if the coupon is greater than or equal to the price, use 0 Return the new list of adjusted prices in the same order. If prices is empty, return an empty list.

Constraints

  • prices contains non-negative whole numbers
  • coupon is a positive whole number
  • Do not change the original list

Function signature

def coupon_prices(prices, coupon):

Sign in to solve this bracket

Reading the problem is free for everyone. Opening the editor and solving it requires an account with Open Bracket+.