0

Age calculator

What do you think? import datetime now = datetime.datetime.now() x = now.year m = now.month d = now.day y = int(input("Birth year: ")) mi = int(input("Month 1-12: ")) di = int(input("Day 1-31: ")) age = (x-y) if mi == m and di == d: print ("Your age is: ", + age) import sys sys.exit() if mi <= m and di <= d: print ("Your age is: ", + age) import sys sys.exit() if mi > m and di >= d: age = ((x-y)-1) print ("Your age is: ", + age) import sys sys.exit() if mi > m and di <= d: age = ((x-y)-1) print ("Your age is: ", + age) import sys sys.exit() if mi <= m and di >= d: print ("Your age is: ", + age) import sys sys.exit() if mi < m and di >= d: print ("Your age is: ", + age) import sys sys.exit()

24th Apr 2018, 6:52 PM
Sergey Zosim
Sergey Zosim - avatar
2 Answers
+ 6
please use the code section so that it could be tested..and 💃💃💃I cannot wait to see your code in action...this will unlock intern badge✴ for you as it being your first code.
24th Apr 2018, 7:01 PM
Awele Omeligwe
Awele Omeligwe - avatar
+ 1
Thank you for the answer. It's available in code section now.
24th Apr 2018, 7:11 PM
Sergey Zosim
Sergey Zosim - avatar