Problem 149271 · easy · Phase 01 Prerequisites & Setup

Sale Price

functions · percentages · arithmetic · rounding

Write sale_price(price, percent_off) that returns the price after a percent_off percent discount, rounded to 2 decimal places.

Examples

Input:  price = 80, percent_off = 25
Output: 60.0
Input:  price = 19.99, percent_off = 10
Output: 17.99

Constraints

  • 0 <= price <= 10**6, 0 <= percent_off <= 100

Goals

  • Subtract a percentage discount from a price
  • Round the result to cents
Starting Python…