LiQuidCrab

Age_Calculator

May 20th, 2020
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.26 KB | None | 0 0
  1. year = int(input ("enter birth year:"))
  2. x = int(input ("enter birth month:"))
  3. y = int(input("current month:"))
  4. age = 2020- year
  5.  
  6. if x<= y:
  7.     mn=y-x
  8.    
  9. elif x > y:
  10.     mn = 12- (x-y)
  11.     age -= 1
  12.    
  13. print ("you are " + str(age) + " years, " + str(mn) + " months old")
Add Comment
Please, Sign In to add comment