Help with some python homework...
Denis McMahon
denismfmcmahon at gmail.com
Sun Feb 2 12:43:01 EST 2014
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, denismfmcmahon at gmail.com
More information about the Python-list
mailing list