Sophie

Sophie

distrib > Mageia > 6 > x86_64 > media > core-release > by-pkgid > 0d4b03f6c024599542f359647823b03c > files > 15

python-egenix-mx-base-doc-3.2.9-2.mga6.noarch.rpm

""" Calculate some informations about lifespans.
"""
from mx.DateTime import *
import sys

# Get data from user
print 'Please enter your birthday (year,month,day), e.g. 1969,12,1:'
try:
    year,month,day = input('>>> ')
except:
    print '* Sorry, wrong entry.'
    sys.exit()
print

# Output the lifespan in different formats
birthday = Date(year,month,day)
lifespan = now() - birthday
print 'Lifespan:'
print ' =',lifespan.days,'days'
print ' =',int(lifespan / (29.53 * oneDay)),'moons (+/- 1)'
print ' =',lifespan / (365.2422 * oneDay),'tropical years'