2026-04-10 15:30:28 +02:00

11 lines
309 B
Python

def discount_price(price: float, percent: float) -> float:
if percent < 0:
raise ValueError("Discount percent cannot be negative")
if percent >= 100:
raise ValueError("Percent must be between 0% and 100%")
return price - price * percent / 100
print(discount_price(100.0, 20.0))