On Saturday, February 8, 2014 10:14:10 AM UTC+5:30, Scott W Dunning wrote: > I have a question that was a part of my homework and I got it correct but the > teacher urged me to do it using the % sign rather than subtracting > everything, for some reason I'm having issues getting it to calculate > correctly. I'll put the question below, and what I originally had and below > that what I've been working on with the %.
Simple hint When you divide a by b, you get a quotient(q) and remainder(r) satisfying the equation a = qb + r Instead of keeping on calculating r by doing r= a - qb you can use python's builtin divmod which will give you q and r together >>> t=65 >>> divmod(t,60) (1, 5) which basically means that 65 secs is 1 min and 5 secs -- https://mail.python.org/mailman/listinfo/python-list