Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #65099
| References | <02c4c69d-71f1-4a01-86df-d4d5a7ffb3f5@googlegroups.com> <mailman.6195.1391146214.18130.python-list@python.org> <8da5d692-1446-4107-9a5a-5efd91f7c051@googlegroups.com> |
|---|---|
| Date | 2014-01-31 17:38 +1100 |
| Subject | Re: Help with some python homework... |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.6197.1391150295.18130.python-list@python.org> (permalink) |
On Fri, Jan 31, 2014 at 5:24 PM, sjud9227 <scottwd80@gmail.com> wrote: > Thank you so much Chris. However, i'm still a little confused. Doesn't assigning seconds/(60*60) mean that calculating 6*hours will give me 6 hours in seconds? Also, why calculate how many seconds from midnight? wouldn't it just be from the time that you left the house at 6:52? Also, for the life of me I cannot figure out how to make everything display in hh:mm:ss. I realize I'm asking a lot especially do to the fact it's homework but, we are allowed help in class I just don't have class again until next Tuesday. Plus I really do want to learn not just get the answers. First things first: You're using Google Groups, so your lines are unwrapped and your quoted text is double spaced. Please fix this every time you post (which requires some fiddling around) or switch to a client that works. I recommend using the mailing list instead: https://mail.python.org/mailman/listinfo/python-list Now then. What is your initial seconds? With the code you posted, it's 1, which means you get nothing at all after dividing by (60*60), so you just have a big ol' zero. What you need to do is convert hours into seconds. Is that going to mean multiplying by a big number or multiplying by a very small number? Think about it as something completely separate from programming. What number will you be multiplying by? Now code that. You can calculate the total number of seconds of your run. You can calculate the number of seconds from midnight until 6:52AM. Add the two together and you get the number of seconds from midnight until you get home. The final step, formatting, is pretty straight-forward. Let's suppose I have a number of seconds, say 40000. That represents some number of hours, some number of minutes, and some number of seconds. How many complete hours are there in 40000 seconds? How many seconds are left over? And out of those left-over seconds, how many minutes can you make? How many seconds are left after the minutes are taken out? These questions are all answered by division and modulo operations. You can actually solve this completely separately from the other part of the problem; try answering it for the figure I gave (40000 seconds), then try it for a few other numbers, and see how it goes. ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Help with some python homework... scottwd80@gmail.com - 2014-01-30 21:12 -0800
Re: Help with some python homework... Chris Angelico <rosuav@gmail.com> - 2014-01-31 16:30 +1100
Re: Help with some python homework... sjud9227 <scottwd80@gmail.com> - 2014-01-30 22:24 -0800
Re: Help with some python homework... Chris Angelico <rosuav@gmail.com> - 2014-01-31 17:38 +1100
Re: Help with some python homework... sjud9227 <scottwd80@gmail.com> - 2014-01-30 22:48 -0800
Re: Help with some python homework... Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-01-31 21:17 +1300
Re: Help with some python homework... Chris Angelico <rosuav@gmail.com> - 2014-01-31 19:30 +1100
Re: Help with some python homework... Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-01-31 23:46 +1300
Re: Help with some python homework... Chris Angelico <rosuav@gmail.com> - 2014-02-01 11:57 +1100
Re: Help with some python homework... Chris Angelico <rosuav@gmail.com> - 2014-02-01 12:34 +1100
Re: Help with some python homework... David <bouncingcats@gmail.com> - 2014-02-01 14:17 +1100
Re: Help with some python homework... Scott W Dunning <swdunning@cox.net> - 2014-01-31 18:14 -0700
Re: Help with some python homework... Denis McMahon <denismfmcmahon@gmail.com> - 2014-02-01 19:32 +0000
Re: Help with some python homework... David Hutto <dwightdhutto@gmail.com> - 2014-02-02 17:12 -0800
Re: Help with some python homework... Larry Hudson <orgnut@yahoo.com> - 2014-02-02 23:48 -0800
Re: Help with some python homework... Scott W Dunning <swdunning@cox.net> - 2014-01-31 17:46 -0700
Re: Help with some python homework... Scott W Dunning <swdunning@cox.net> - 2014-01-31 17:42 -0700
Re: Help with some python homework... David <bouncingcats@gmail.com> - 2014-02-01 17:13 +1100
Re: Help with some python homework... Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-02-01 10:44 -0500
Re: Help with some python homework... Neil Cerutti <neilc@norwich.edu> - 2014-01-31 13:51 +0000
Re: Help with some python homework... Denis McMahon <denismfmcmahon@gmail.com> - 2014-02-01 03:02 +0000
Re: Help with some python homework... Scott W Dunning <swdunning@cox.net> - 2014-01-31 17:35 -0700
Re: Help with some python homework... Scott W Dunning <swdunning@cox.net> - 2014-01-31 22:18 -0700
Re: Help with some python homework... Denis McMahon <denismfmcmahon@gmail.com> - 2014-02-01 19:45 +0000
Re: Help with some python homework... David Hutto <dwightdhutto@gmail.com> - 2014-02-02 08:11 -0800
Re: Help with some python homework... David Hutto <dwightdhutto@gmail.com> - 2014-02-02 08:36 -0800
Re: Help with some python homework... MRAB <python@mrabarnett.plus.com> - 2014-02-02 16:38 +0000
Re: Help with some python homework... David Hutto <dwightdhutto@gmail.com> - 2014-02-02 08:57 -0800
Re: Help with some python homework... Denis McMahon <denismfmcmahon@gmail.com> - 2014-02-02 17:43 +0000
Re: Help with some python homework... David Hutto <dwightdhutto@gmail.com> - 2014-02-02 10:09 -0800
Re: Help with some python homework... David Hutto <dwightdhutto@gmail.com> - 2014-02-02 11:08 -0800
Re: Help with some python homework... David Hutto <dwightdhutto@gmail.com> - 2014-02-02 11:21 -0800
Re: Help with some python homework... "Rhodri James" <rhodri@wildebst.org.uk> - 2014-02-02 17:15 +0000
Re: Help with some python homework... Scott W Dunning <swdunning@cox.net> - 2014-01-31 22:04 -0700
Re: Help with some python homework... Scott W Dunning <swdunning@cox.net> - 2014-01-31 17:07 -0700
Re: Help with some python homework... Scott W Dunning <swdunning@cox.net> - 2014-01-31 22:19 -0700
Re: Help with some python homework... Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-02-01 10:50 -0500
Re: Help with some python homework... Scott W Dunning <swdunning@cox.net> - 2014-02-01 23:06 -0700
csiph-web