Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.034 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'calculating': 0.09; 'guys!': 0.09; 'lines.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:Help': 0.11; 'jan': 0.12; 'message-id:@4ax.com': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subtract': 0.16; 'subject:python': 0.16; '3.0': 0.19; 'url:home': 0.24; 'guys': 0.24; 'question': 0.24; 'defined': 0.27; 'header:X-Complaints- To:1': 0.27; 'code': 0.31; '-0700,': 0.31; 'subject:some': 0.31; 'another': 0.32; 'fri,': 0.33; 'could': 0.34; 'subject:with': 0.35; 'problem.': 0.35; 'but': 0.35; 'skip:> 10': 0.36; 'thanks': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'removing': 0.60; 'different': 0.65; 'chance': 0.65; 'price': 0.69; 'price.': 0.74; '100%': 0.77; '40%': 0.84; 'have?': 0.84; 'discount': 0.87; 'don\xe2\x80\x99t': 0.91; 'received:108': 0.93; 'scott': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dennis Lee Bieber Subject: Re: Help with some python homework... Date: Sat, 01 Feb 2014 10:50:22 -0500 Organization: IISS Elusive Unicorn References: <02c4c69d-71f1-4a01-86df-d4d5a7ffb3f5@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: adsl-108-68-178-125.dsl.klmzmi.sbcglobal.net X-Newsreader: Forte Agent 6.00/32.1186 X-No-Archive: YES X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 24 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1391269813 news.xs4all.nl 2903 [2001:888:2000:d::a6]:40972 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:65223 On Fri, 31 Jan 2014 22:18:34 -0700, Scott W Dunning 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@ix.netcom.com HTTP://wlfraed.home.netcom.com/