Advertisement
Guest User

Untitled

a guest
Nov 11th, 2019
914
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.49 KB | None | 0 0
  1. from datetime import date
  2.  
  3. a=input('Enter your birthdate :')
  4. b=a.split("/")
  5.  
  6. t = date.today()
  7. d = t.strftime("%d/%m/%Y").split("/")
  8.  
  9.  
  10. if   int(d[0])==int(b[0]) and int(d[1])==int(b[1]):
  11.     print('Happy Birthday !')
  12. elif int(d[0])>=int(b[0]):
  13.     print("You're",int(d[2])-int(b[2]),"years and",int(d[1])-int(b[1]),"months and",int(d[0])-int(b[0]),"days old !" )
  14. else:
  15.     print("You're",int(d[2])-int(b[2]),"years and",int(d[1])-int(b[1])-1,"months and",int(d[0])-int(b[0])+30,"days old !" )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement