Help with some python homework...

Scott W Dunning swdunning at
Sat Feb 1 06:04:07 CET 2014

Ok cool, thanks Denis!

On Jan 31, 2014, at 8:02 PM, Denis McMahon <denismfmcmahon at> wrote:

> On Thu, 30 Jan 2014 21:12:19 -0800, scottwd80 wrote:
>> Here is the question that was asked and below that I'll paste the code I
>> have so far.
> The following is a reasonably but not highly obfuscated short solution to 
> the problem set in python 2.7. With a bit of luck, after each lesson of 
> your course, you'll be able to understand a bit more of how it works.
> M=60;H=M*60
> def s(h,m,s): return h*H+m*M+s
> def hms(s): return (int(s/H),int((s%H)/M),s%M)
> (a,b,c)=hms(s(6,52,0)+3*s(0,7,12)+2*s(0,8,15))
> print "{:02d}:{:02d}:{:02d}".format(a,b,c)
> When you can write a short paragraph describing what each line of the 
> program does, you'll be on your way to understanding a few of the 
> structures, syntaxes and mechanisms of python.
> Or you could show it to your lecturer or a TA and say it was suggested 
> that you ask her or him to work through it with you.
> -- 
> Denis McMahon, denismfmcmahon at
> -- 

More information about the Python-list mailing list