Python 2.7.6 help with modules

Scott W Dunning swdunning at cox.net
Sun Feb 9 23:31:03 EST 2014


On Feb 8, 2014, at 11:30 PM, Chris Angelico <rosuav at gmail.com> wrote:
OH, I think I figured it out.  

> time = int(raw_input("Enter number of seconds: “))
1000000
> seconds = time % 60
Remainder of 40 <- for seconds.
> time /= 60
Here you take 1000000/60 = 16666 (which = time for the next line).
> minutes = time % 60
16666/60 with a remainder of 46 <- minutes
> time /= 60
Then take 16666/60 = 277 (which = time for the line below to use).
> hours = time % 24
Then we use 277/24 with a remainder of 13 <- hours
> time /= 24
Then it use 277/24…….. 
> days = time % 7
> time /= 7
> weeks = time

I guess I answered my own question and it looks like it wouldn’t matter if you did it opposite from weeks to seconds.  

Thanks again for all your help everyone!

Scott




More information about the Python-list mailing list