From 6a2cf3930599f9ddc6a388502ff39b7c06bfe461 Mon Sep 17 00:00:00 2001 From: Zeeshan Latif <67405028+Zeeshan6781@users.noreply.github.com> Date: Thu, 1 Oct 2020 07:02:37 +0500 Subject: [PATCH] Create ageCalculator.py --- ageCalculator.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 ageCalculator.py diff --git a/ageCalculator.py b/ageCalculator.py new file mode 100644 index 0000000..94e9c70 --- /dev/null +++ b/ageCalculator.py @@ -0,0 +1,30 @@ +yearAge = int(input("Enter your age/year of birth:\n")) +isAge = False +isYear = False + +if yearAge < 125: + isAge = True + +elif yearAge > 1900: + isYear = True + +else: + print("There was some problem with your age/year of birth!") + exit() + +if yearAge <1900 and isYear: + print("You seem to be the oldest person alive!") + exit() + +if yearAge > 2020 and isYear: + print("You are not yet born!") + exit() + +if isAge: + yearAge = 2020 - yearAge + +print(f"You will be 100 years old in {yearAge + 100}") + +interestedYear = int(input("\nEnter the year you want to know your age in:\n")) + +print(f"You will be {interestedYear - yearAge} year old in {interestedYear}")