Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #65799
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.017 |
| X-Spam-Evidence | '*H*': 0.97; '*S*': 0.00; 'base.': 0.05; 'subject:Python': 0.06; 'subject:help': 0.08; '40,': 0.09; 'lost.': 0.09; 'subject:modules': 0.09; 'cc:addr:python-list': 0.11; '60,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'once.': 0.16; 'remainder': 0.16; 'seconds.': 0.16; 'wrote:': 0.18; 'feb': 0.22; 'cc:addr:python.org': 0.22; 'mon,': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'correct': 0.29; 'sets': 0.30; 'message-id:@mail.gmail.com': 0.30; 'up:': 0.31; 'probably': 0.32; 'subject:with': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'next': 0.36; 'changing': 0.37; 'seconds': 0.37; 'pm,': 0.38; 'little': 0.38; 'does': 0.39; 'how': 0.40; 'first': 0.61; 'here': 0.66; 'line,': 0.68; 'clearer': 0.84; 'confusing': 0.84; 'divide': 0.84; 'it\xe2\x80\x99s': 0.84; 'to:none': 0.92; 'scott': 0.93 |
| 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:content-transfer-encoding; bh=qkXoh7mAcnyE4acvzd2jyfiUISwkR2RSAooQRXgFB3A=; b=You1hGdARUbfyRRfy4dhi0dLOfmO2Xj6vj88MZwDTIvvbXI6QrfwmusWP/K+Fl5KNt HivsQC+JdlRYYd1s41/0549/9qH5HQuWumg7EXyMD+D1R/g9MY6/X3pNqdJb3AxFaPQb JR3vpEZgeALbmXxJ5DjILg07LLFngSHafvM+5llRFg8ypcqC2YDH3Db8LeeiPcfilY7w tfrTrdTiNqVXsdQKKM722qCebHisOvR/0eZcSDH34nVIjkasVAxcdHaPp+o6+TfXhC6K dp+7VDUim6GzA3sb5BX+yoOGN43xTusY0rGpiKxUufBLsniO/0kK2c0JH7vkQPcPZ/iV Wkrw== |
| MIME-Version | 1.0 |
| X-Received | by 10.68.182.165 with SMTP id ef5mr810281pbc.169.1392006655257; Sun, 09 Feb 2014 20:30:55 -0800 (PST) |
| In-Reply-To | <972E1362-8C9D-47BC-BAD7-A0CA754C8D84@cox.net> |
| References | <032F2E23-6983-4710-B087-C1771B66C3EF@cox.net> <635C857D-1F7A-4F95-B3A7-F1A3C69BF137@cox.net> <1DA52F3B-CE00-4E47-BE84-C07482966FD7@cox.net> <F4033A14-BA16-4897-9998-65D431B5071C@cox.net> <972E1362-8C9D-47BC-BAD7-A0CA754C8D84@cox.net> |
| Date | Mon, 10 Feb 2014 15:30:55 +1100 |
| Subject | Re: Python 2.7.6 help with modules |
| From | Chris Angelico <rosuav@gmail.com> |
| Cc | "python-list@python.org" <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | quoted-printable |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.6611.1392006658.18130.python-list@python.org> (permalink) |
| Lines | 25 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1392006658 news.xs4all.nl 2844 [2001:888:2000:d::a6]:55598 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:65799 |
Show key headers only | View raw
On Mon, Feb 10, 2014 at 3:17 PM, Scott W Dunning <swdunning@cox.net> wrote:
> How to do it from the small end up:
>
> time = int(raw_input("Enter number of seconds: "))
> seconds = time % 60
>
> So here it takes say 1000000 and divides it by 60 to put in seconds and
> spits out the remainder? 1000000 / 60 is approximately 16666 with a
> remainder of about 40, which would be the correct amount for seconds. From
> there I get a little lost.
>
> time /= 60
>
> Then we take the remainder (40) from above and divide that by 60? Already
> it’s confusing me.
The first part just spits out the remainder, without changing the
base. It'll set seconds to 40 (exactly, not about), but time is still
1000000. Then in the next line, we divide time by 60, which sets it to
that quotient (16666). This is why it's probably clearer to use
divmod, which does both halves (quotient and remainder) at once.
ChrisA
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Python 2.7.6 help with modules Chris Angelico <rosuav@gmail.com> - 2014-02-10 15:30 +1100
csiph-web