python-test/Module 1/Task 1/main.py

5 lines
No EOL
189 B
Python

def calculate_discount(price: float, discount: int) -> float:
if discount > 50:
raise ValueError("Discount can't be more than 50%")
else:
return price - (price / 100) * discount