Help with some python homework...
Scott W Dunning
swdunning at cox.net
Sun Feb 2 07:06:18 CET 2014
Yeah you’re right I didn’t even notice that. For some reason I just added the 60 instead of using quantity which had been defined.
On Feb 1, 2014, at 8:50 AM, Dennis Lee Bieber <wlfraed at ix.netcom.com> wrote:
> On Fri, 31 Jan 2014 22:18:34 -0700, Scott W Dunning <swdunning at cox.net>
> declaimed the following:
>> Any chance you guys could help with another question I have? Below is a code to a different problem. The only thing I don’t understand is why when calculating the 'discounted price’ you have to subtract 1? Thanks again guys!
> Because the discount rate you have is the amount taken OFF the price.
> But you need the price AFTER removing the discount amount 100% (1.0) - 40%
> (0.4) discount => 60% (0.6) final price
>> price_per_book = 24.95
>> discount = .40
>> quantity = 60
>> discounted_price = (1-discount) * price_per_book
>> shipping = 3.0 + (60 - 1) * .75
>> total_price = 60 * discounted_price + shipping
>> print total_price, 'Total price'
> You defined "quantity" but then never used it in the shipping and
> total_price lines.
> Wulfraed Dennis Lee Bieber AF6VN
> wlfraed at ix.netcom.com HTTP://wlfraed.home.netcom.com/
More information about the Python-list