Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions ageCalculator.py
Original file line number Diff line number Diff line change
@@ -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}")