Date: 2009-01-18 08:31 am (UTC)
My first python program :)

def plural( num):
    if num == 1:
        return ""
    else:
        return "s"

totalSeconds = input("How many seconds?")
hours = totalSeconds / 3600
remainingSeconds = totalSeconds % 3600
minutes = remainingSeconds / 60
seconds = remainingSeconds % 60

print str(hours) + " hour" + plural( hours) + ", " + str(minutes) + " minute" + plural( minutes) + ", and " + str(seconds) + " second" + plural( seconds) + "."

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

March 2025

S M T W T F S
      1
2345678
9101112131415
161718192021 22
23242526272829
3031     

Most Popular Tags