P59NumPyBeginnerCalculate5 min

Calculate the Output of a Broadcasted Price Adjustment

Calculate prices after one discount vector is broadcast across a product-price matrix.

#numpy#arrays#broadcasting

Scenario

Prices are [[100, 200, 300], [80, 120, 160]] and channel discounts are [0.10, 0.20, 0.00].

Problem statement

Calculate prices * (1 - discounts).

Your Task

  1. Apply each discount to its column.
  2. Write the resulting matrix.
  3. Explain broadcasting.

Related Concepts

NumPyBroadcastingArray shapes

Ready to count this problem?

Mark it complete when you have reasoned through the solution in your own words.