1. Numbers, Python

    Write a program which tells you:

    • how many hours are in a year?
    • how many minutes are in a decade?
    • how many seconds old are you?

    Code:

    print 24*365, 60*24*365*10, (60*60)*((365*32)+(30*8))
    

    Output:

    8760 5256000 42912000
    

    Harder: If I am 1031 million seconds old, how old am I?

    print '1,031,000,000 seconds = %s minutes' % (1031000000/60)
    print 'or %s hours' % (1031000000/(60*60))
    print 'or %s days' % (1031000000/(60*60*24))
    print 'or %s years' % (1031000000/(60*60*24*365.25))
    

    Output:

    1,031,000,000 seconds = 17183333 minutes
    or 286388 hours
    or 11932 days
    or 32.6704185363 years