Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.037 X-Spam-Evidence: '*H*': 0.93; '*S*': 0.00; 'subject:Python': 0.06; 'subject:help': 0.08; '40,': 0.09; 'lost.': 0.09; 'subject:modules': 0.09; 'weeks,': 0.09; 'cc:addr:python-list': 0.11; 'minutes?': 0.16; 'remainder': 0.16; 'seconds.': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'received:10.0.1': 0.19; 'seems': 0.21; 'feb': 0.22; 'email addr:gmail.com>': 0.22; 'cc:addr:python.org': 0.22; 'days,': 0.24; 'mind.': 0.24; 'question': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'correct': 0.29; 'chris': 0.29; 'up:': 0.31; 'weeks': 0.32; 'subject:with': 0.35; 'there': 0.35; 'received:10.0': 0.36; 'seconds': 0.37; 'received:10': 0.37; 'step': 0.37; 'being': 0.38; 'pm,': 0.38; 'little': 0.38; '(from': 0.39; 'how': 0.40; 'days': 0.60; 'new': 0.61; 'header:Message-Id:1': 0.63; 'more': 0.64; 'taking': 0.65; 'to:addr:gmail.com': 0.65; 'charset:windows-1252': 0.65; 'hours': 0.66; 'here': 0.66; 'minutes': 0.67; '2014,': 0.84; 'confusing': 0.84; 'divide': 0.84; 'it\x92s': 0.84 X-CT-Class: Clean X-CT-Score: 0.00 X-CT-RefID: str=0001.0A020208.52F852F2.007A,ss=1,re=0.000,fgs=0 X-CT-Spam: 0 X-Authority-Analysis: v=2.0 cv=C/M3P3z+ c=1 sm=1 a=MB85R812cvcrhCHz/P2OVA==:17 a=IwL8z8QTeS0A:10 a=G8Uczd0VNMoA:10 a=kviXuzpPAAAA:8 a=_HE405UYfI8A:10 a=pGLkceISAAAA:8 a=7gaRXql4RD4-nPiPRtkA:9 a=pILNOxqGKmIA:10 a=MSl-tDqOz04A:10 a=KL1jPCYiKQhJWQN1:21 a=5vGMRFr_Rfr_0Wsf:21 a=jt3_HVOhQ4KY1tV-sKgA:9 a=_W_S_7VecoQA:10 a=MB85R812cvcrhCHz/P2OVA==:117 X-CM-Score: 0.00 Authentication-Results: cox.net; auth=pass (PLAIN) smtp.auth=swdunning@cox.net Content-Type: multipart/alternative; boundary="Apple-Mail=_9BC5311C-83FC-4FE4-AC8F-DB42D69724B1" Mime-Version: 1.0 (Mac OS X Mail 7.1 \(1827\)) Subject: Re: Python 2.7.6 help with modules From: Scott W Dunning In-Reply-To: Date: Sun, 9 Feb 2014 21:17:52 -0700 References: <032F2E23-6983-4710-B087-C1771B66C3EF@cox.net> <635C857D-1F7A-4F95-B3A7-F1A3C69BF137@cox.net> <1DA52F3B-CE00-4E47-BE84-C07482966FD7@cox.net> To: Chris Angelico X-Mailer: Apple Mail (2.1827) Cc: "python-list@python.org" 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: 93 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1392005882 news.xs4all.nl 2890 [2001:888:2000:d::a6]:52348 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:65798 --Apple-Mail=_9BC5311C-83FC-4FE4-AC8F-DB42D69724B1 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 On Feb 8, 2014, at 11:30 PM, Chris Angelico wrote: I have one more question on this if you don=92t mind. I=92m a bit = confused on how it works this way without it being in seconds? I=92ll = answer below each step of how it seems to work to me. > How to do it from the small end up: >=20 > time =3D int(raw_input("Enter number of seconds: ")) > seconds =3D 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. = =46rom there I get a little lost. > time /=3D 60 Then we take the remainder (40) from above and divide that by 60? = Already it=92s confusing me. =20 > minutes =3D time % 60 Are we still using the new number from above for time and dividing that = by 60 and using the remainder for minutes? =20 > time /=3D 60 Then taking the remainder from the line above and so on and so on=85? > hours =3D time % 24 > time /=3D 24 > days =3D time % 7 > time /=3D 7 > weeks =3D time > # Alternative way to format for display: > print("%d weeks, %d days, = %02d:%02d:%02d"%(weeks,days,hours,minutes,seconds)) >=20 Also, would it work the same way with smaller divisors the other way = around (from weeks - seconds)? --Apple-Mail=_9BC5311C-83FC-4FE4-AC8F-DB42D69724B1 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=windows-1252
On Feb 8, 2014, at 11:30 PM, Chris = Angelico <rosuav@gmail.com> = wrote:

I have one more question on this if you don=92t= mind.  I=92m a bit confused on how it works this way without it = being in seconds?  I=92ll answer below each step of how it seems to = work to me.

How to do it from the small end up:

time = =3D int(raw_input("Enter number of seconds: "))
seconds =3D 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.  =46rom there I get a little = lost.

time /=3D = 60
Then we take the remainder (40) from above and divide = that by 60?  Already it=92s confusing me.  

minutes =3D time % 60
Are we still = using the new number from above for time and dividing that by 60 and = using the remainder for minutes?  

time /=3D 60

Then taking = the remainder from the line above and so on and so = on=85?

hours =3D time % 24
time /=3D = 24
days =3D time % 7
time /=3D 7
weeks =3D time
# = Alternative way to format for display:
print("%d weeks, %d days, = %02d:%02d:%02d"%(weeks,days,hours,minutes,seconds))

Al= so, would it work the same way with smaller divisors the other way = around (from weeks - = seconds)?








= --Apple-Mail=_9BC5311C-83FC-4FE4-AC8F-DB42D69724B1--