Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #65095

Re: Help with some python homework...

Path csiph.com!usenet.pasdenom.info!news.etla.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!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.098
X-Spam-Evidence '*H*': 0.80; '*S*': 0.00; 'part,': 0.09; 'cc:addr :python-list': 0.11; 'subject:Help': 0.11; 'jan': 0.12; '6:52': 0.16; 'assignments': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'measured': 0.16; 'parts.': 0.16; 'seconds,': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'pace': 0.19; 'pieces': 0.19; 'not,': 0.20; 'work,': 0.20; '(the': 0.22; 'cc:addr:python.org': 0.22; '31,': 0.24; 'hours,': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'correct': 0.29; 'leave': 0.29; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'that.': 0.31; 'produces': 0.31; 'subject:some': 0.31; 'there.': 0.32; 'probably': 0.32; 'figure': 0.32; 'run': 0.32; 'beginning': 0.33; 'fri,': 0.33; 'subject:with': 0.35; 'display': 0.35; 'convert': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'achieving': 0.36; 'minutes,': 0.36; 'doing': 0.36; 'next': 0.36; 'thanks': 0.36; "i'll": 0.36; 'seconds': 0.37; 'so,': 0.37; 'two': 0.37; 'being': 0.38; 'represent': 0.38; 'pm,': 0.38; 'anything': 0.39; 'according': 0.40; 'how': 0.40; 'easy': 0.60; 'then,': 0.60; 'most': 0.60; 'simple': 0.61; "you're": 0.61; 'first': 0.61; "you'll": 0.62; "you've": 0.63; 'different': 0.65; 'hours': 0.66; 'minutes': 0.67; 'six': 0.68; 'useful.': 0.68; 'home': 0.69; 'home.': 0.72; 'mile': 0.84; 'tempo': 0.84; 'together,': 0.84; 'aka': 0.91; '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=eIRHwwTnXYIMB+0/MkJkmEOyp3LaPkTTR7Ri/J6Ojvs=; b=Rir4pAWfln52Cm0X1tBoScd5TwlvcIGu/MNrTuMKk+bL8hZONQTb9OMy6+6fVFbjph iIf9yKsL+bDxo7CT3kEQwTggPi1F7tVaNdwq4T+XW3IJnrbMZJMJPccA8ppuAe8DHWYo Lpt01mb8UCt+lNlGs+MrbVr08+Jr/dCCezEiuuVz393Kr+XRA+FlikuqQvVyaD8SD/P5 uczcfibeKMDlRegleR+CTw1RNChRK77pRITfmL1f/RqYBYnNCvz4VKyWimOWK61yVnsr VjvjuFDTyDGv4Xl0JT6/B+t3G5/V6Zu23zQJCMcaPgHD86H7nDGunkwiFMCbLmMluGNO wH4w==
MIME-Version 1.0
X-Received by 10.68.133.6 with SMTP id oy6mr18583692pbb.153.1391146211087; Thu, 30 Jan 2014 21:30:11 -0800 (PST)
In-Reply-To <02c4c69d-71f1-4a01-86df-d4d5a7ffb3f5@googlegroups.com>
References <02c4c69d-71f1-4a01-86df-d4d5a7ffb3f5@googlegroups.com>
Date Fri, 31 Jan 2014 16:30:11 +1100
Subject Re: Help with some python homework...
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <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 <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.6195.1391146214.18130.python-list@python.org> (permalink)
Lines 46
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1391146214 news.xs4all.nl 2917 [2001:888:2000:d::a6]:60931
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:65095

Show key headers only | View raw


On Fri, Jan 31, 2014 at 4:12 PM,  <scottwd80@gmail.com> wrote:
> **If I leave my house at 6:52 am and run 1 mile at an easy pace (8:15 per mile), then 3 miles at tempo (7:12 per mile) and 1 mile at easy pace again, what time do I get home for breakfast?**
>
>
>
>      seconds = 1
>      hours = seconds / (60*60)
>      seconds = seconds - hours*60*60
>      minutes = seconds / 60
>      seconds = seconds - minutes *60
>
>      time_left_house = 6 * hours + 52 * minutes
>
>      miles_run_easy_pace = 2 * (8 * minutes + 15 * seconds)
>
>      miles_run_fast_pace = 3 * (7 * minutes + 12 * seconds)
>
>
>      total_time_run = miles_run_easy_pace + miles_run_fast_pace + time_left_house

Thanks for being up-front about it being homework. I'll give you one
broad hint, and see if you can figure it out from there.

Your beginning work is not actually achieving anything useful. To make
your next steps work, what you actually want is two very simple
assignments that will mean that "6 * hours" comes out as the number of
seconds in six hours. Then, when you've added all the different pieces
together, you'll have a final time that's measured in seconds - and
since that final time includes the time_left_house, it's actually
going to be the number of seconds since midnight. This is actually an
excellent way to represent time (number of seconds since some
"beginning point" aka epoch). There's then just one last step: Convert
it into hours, minutes, and seconds, for display. You have most of the
code for doing that.

So, work on this in two parts. In the first part, make your program
calculate how many seconds after midnight you'll get home. (The
correct answer there is 27006, according to my calculations. Of
course, you need to have a program that produces the correct answer,
not just the answer.) Then work out how to make that display as
hh:mm:ss.

I think you can probably get it from there - you're already a lot of
the way toward it. But if not, you know where to find us :)

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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