# computes approximately how many days # you have lived w/o considering partial # or leap years. # # shows use of CONSTANT and string function # # shows the use of an if-else statement too. # # written by e.bonakdarian oct 2009 # from string import capitalize DAYS_IN_YEAR = 365 print 'Program will compute approximately how old you are in days' print '(without considering partial or leap years)' print name = raw_input('What is your name? ') age = input('How old are you (in years)? ') if age > 0: days_lived = age * DAYS_IN_YEAR print ('Dear %s, you are approximately %d days old.' % (capitalize(name), days_lived)) else: # age <= 0 .. no good! print 'Error: You have to be older than 0 years :-)' raw_input(' to exit')