Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3a.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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python,': 0.02; 'assigning': 0.09; 'calculating': 0.09; 'cc:addr:python-list': 0.11; 'subject:Help': 0.11; 'jan': 0.12; '__future__': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'integers,': 0.16; 'remainder': 0.16; 'unnecessary.': 0.16; 'subject:python': 0.16; ':-)': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; '31,': 0.24; 'instead.': 0.24; 'versions': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'point': 0.28; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; 'gives': 0.31; 'division': 0.31; 'subject:some': 0.31; 'fri,': 0.33; 'subject:with': 0.35; 'no,': 0.35; 'received:google.com': 0.35; 'done': 0.36; 'should': 0.36; 'seconds': 0.37; 'pm,': 0.38; 'rather': 0.38; 'short': 0.38; 'does': 0.39; 'even': 0.60; '(that': 0.65; 'hours': 0.66; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=ulB1rYiAzKgZXyowSgvX5I0PTBnzSpoUiI0mwuZQJzc=; b=ZMe8fr2qZlBc/LFxQW+lcrobK6sA5PkIj9yTDgiOPtTiIP6ijEjNjSWg/xt9WKtYWD YJK4ZfPHt7tg5BXpIr7dGVC8+LNDTX+QMza9FGQnWN9qZ985hkVvKASpmEQyyfkhxdze 3SK5JQDI2QVdBnndzASu8cb5kU505w4PyDf/odnEJTR65oBH3aW6pTbr8x2M6ruYlTzZ ro/PwMDJVzP819pZ/Pte0LyPdLWOddqPG1PKXmD/7CV7yut0RugnIkOAk1TZO6FQ0KZY X8xgjOljbllg/qV7U79dBiH1dW+zuAv1C7Kp08Vg13iBacGPDSxCNAkbWkjIeSnJOkOL 8vEA== MIME-Version: 1.0 X-Received: by 10.66.26.176 with SMTP id m16mr19592108pag.142.1391157024967; Fri, 31 Jan 2014 00:30:24 -0800 (PST) In-Reply-To: References: <02c4c69d-71f1-4a01-86df-d4d5a7ffb3f5@googlegroups.com> <8da5d692-1446-4107-9a5a-5efd91f7c051@googlegroups.com> Date: Fri, 31 Jan 2014 19:30:24 +1100 Subject: Re: Help with some python homework... From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 29 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1391157029 news.xs4all.nl 2878 [2001:888:2000:d::a6]:42430 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:65106 On Fri, Jan 31, 2014 at 7:17 PM, Gregory Ewing wrote: > sjud9227 wrote: >> >> Doesn't >> assigning seconds/(60*60) mean that calculating 6*hours will give me 6 >> hours >> in seconds? > > No, it's giving you 6 seconds in hours. (That should > give you a clue as to what you should have done > instead. :-) > > ... > > a // b gives the quotient of dividing a by b > > a % b gives the remainder > > (I recommend using '//' rather than just '/', because > in some versions of Python, a/b does floating point > division even if a and b are both integers, and that's > not what you want here.) OP is using 2.7.6, so short of a __future__ directive, that won't actually give 6 seconds in hours (though it will try to), and // is unnecessary. ChrisA