On Sun, 02 Feb 2014 08:57:03 -0800, David Hutto wrote:

> Revised:

> discounted_price = price_per_book - (price_per_book * percent_discount)

by applying some simple algebra to the right hand side

price_per_book - (price_per_book * percent_discount)

"x = (x * 1)" so "price_per_book == (price_per_book * 1)" so rhs becomes

(price_per_book * 1) - (price_per_book * percent_discount)

and "(a * x) - (a * y)" == "a * (x - y)" so rhs becomes

price_per_book * (1 - percent_discount)

hence:

discounted_price = price_per_book * (1 - percent_discount)

-- 
Denis McMahon, denismfmcma...@gmail.com
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to