Advertisement
182days

Age Calculator

Apr 15th, 2016
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.61 KB | None | 0 0
  1. #Age Calculator
  2. #Uses today and DOB to calculate various statistics about a users age
  3. from datetime import datetime
  4. import time
  5. dob = input("Enter DOB, use dd/mm/yyyy format: ")
  6. dob = datetime.strptime(dob, '%d/%m/%Y')
  7. print("Here are your age statistics...")
  8. time.sleep(2)
  9. print ("Years : %d" % ((datetime.today() - dob).days/365))
  10. print ("Months : %d" % ((datetime.today() - dob).days/30))
  11. print ("Hours : %d" % ((datetime.today() - dob).days*24))
  12. print ("Minutes : %d" % ((datetime.today() - dob).days*1440))
  13. print ("Seconds : %d" % ((datetime.today() - dob).days*86400))
  14. x=input("Press enter to exit...")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement