Help with some python homework...

Denis McMahon denismfmcmahon at
Sat Feb 1 04:02:49 CET 2014

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.

def s(h,m,s): return h*H+m*M+s
def hms(s): return (int(s/H),int((s%H)/M),s%M)
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