Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #65706
| Subject | Re: Python 2.7.6 help with modules |
|---|---|
| From | Scott W Dunning <swdunning@cox.net> |
| Date | 2014-02-08 18:21 -0700 |
| References | <032F2E23-6983-4710-B087-C1771B66C3EF@cox.net> <635C857D-1F7A-4F95-B3A7-F1A3C69BF137@cox.net> <PiY11n00m3bjUJS01iY3b8> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.6557.1391910755.18130.python-list@python.org> (permalink) |
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
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
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
csiph-web