apply_discount(price, pct) that returns the discounted price — but raises ValueError with the message 'pct must be between 0 and 100' when pct is outside that range. Validating inputs by raising (not returning error codes) is the Pythonic contract.apply_discount(200, 25)
150.0
25% off 200.
apply_discount(200, 150)
ValueError: pct must be between 0 and 100
Out-of-range percentage.
raise ValueError('...') aborts the function.
Check before computing.