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


Groups > comp.lang.python > #65706 > unrolled thread

Re: Python 2.7.6 help with modules

Started byScott W Dunning <swdunning@cox.net>
First post2014-02-08 18:21 -0700
Last post2014-02-08 23:00 -0800
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Python 2.7.6 help with modules Scott W Dunning <swdunning@cox.net> - 2014-02-08 18:21 -0700
    Re: Python 2.7.6 help with modules Larry Hudson <orgnut@yahoo.com> - 2014-02-08 23:00 -0800

#65706 — Re: Python 2.7.6 help with modules

FromScott W Dunning <swdunning@cox.net>
Date2014-02-08 18:21 -0700
SubjectRe: Python 2.7.6 help with modules
Message-ID<mailman.6557.1391910755.18130.python-list@python.org>
I figured it out!  Thanks Chris!  Taking it one step at a time with the five digit number really helped me to see how to break it all up!  Are you a teacher?  I appreciate the help and the patients!  I like that you don’t just give me the answer that you break it down and help me so that I can figure it out on my own!  Thanks to all of you for all of your help, you guys are helping me a lot and I really appreciate it!

Here is how I did it if you’re curious.….

seconds = raw_input("Enter the number of seconds:")
seconds = int(seconds)
weeks = seconds/604800
weeks_rem = seconds % 604800
days = weeks_rem / 86400
days_rem = seconds % 86400
hours = days_rem / 3600
hours_rem = seconds % 3600
minutes = hours_rem / 60
minutes_rem = seconds % 60
seconds = minutes_rem % 60

print weeks, 'weeks', days, 'days', hours, 'hours', minutes, 'minutes', seconds, 'seconds'

Not sure if that’s the correct way to do it but it works!   If there is any other advice I’ll take it.  




On Feb 7, 2014, at 11:29 PM, Chris Angelico <rosuav@gmail.com> wrote:

> On Sat, Feb 8, 2014 at 5:27 PM, Scott W Dunning <swdunning@cox.net> wrote:
>> Ok, so it this what you’re talking about?
>> 
>> 
>> number = int(raw_input(“Enter a five digit number:))
>> foo = number % 10
>> bar = number / 10
>> 
>> digit = foo / 10
>> rem = bar % 10
>> 
> 
> Close! But if you print out foo and bar, you'll see that you're naming
> them backwards in the second one. The last digit is the remainder
> (modulo), the rest is the quotient.
> 
> ChrisA
> -- 
> https://mail.python.org/mailman/listinfo/python-list

[toc] | [next] | [standalone]


#65730

FromLarry Hudson <orgnut@yahoo.com>
Date2014-02-08 23:00 -0800
Message-ID<_LednUQQ4rwHumrPnZ2dnUVZ_t-dnZ2d@giganews.com>
In reply to#65706
On 02/08/2014 05:21 PM, Scott W Dunning wrote:
> I figured it out!  Thanks Chris!  Taking it one step at a time with the five digit number really helped me to see how to break it all up!  Are you a teacher?  I appreciate the help and the patients!  I like that you don’t just give me the answer that you break it down and help me so that I can figure it out on my own!  Thanks to all of you for all of your help, you guys are helping me a lot and I really appreciate it!
>
> Here is how I did it if you’re curious.….
>
> seconds = raw_input("Enter the number of seconds:")
> seconds = int(seconds)
...
<snip>

One very trivial nit...  Add one or two spaces at the end of your prompt string.  Simply as a 
matter of aesthetics--it looks nicer if your input doesn't butt up solidly against the prompt.
(Personally, I like two spaces, but YMMV...)    ;-)

Of course, this is just for the appearance, it makes absolutely no difference in your results.

      -=- Larry -=-

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web