S SearchRSS
< BackHome
Newest questions tagged python - Stack Overflow

Python discount function returns negative value and passes all linters, mypy, bandit and unit tests

I have this pricing function in a Python e-commerce application: def apply_discount(price, discount): return price * (1 - discount) It works correctly for normal inputs: apply_discount(100, 0.20) # returns 80.0

View original source