We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents e55a24f + e667b30 commit b800c09Copy full SHA for b800c09
Age_Calculator/Age_Calculator.py
@@ -9,15 +9,15 @@ def calculate_age(birthday):
9
10
day_check = ((today.month, today.day) < (birthday.month, birthday.day))
11
year_diff = today.year - birthday.year - day_check
12
- remaining_months = abs(today.month - birthday.month)
+ remaining_months = abs((12-birthday.month)+today.month)
13
remaining_days = abs(today.day - birthday.day)
14
15
# Return the age as a formatted string
16
age_string = f"Age: {year_diff} years, {remaining_months} months, and {remaining_days} days"
17
return age_string
18
19
if __name__ == "__main__":
20
- print("Simple Age Calculator")
+ print(" Age Calculator By Python")
21
22
try:
23
birthYear = int(input("Enter the birth year: "))
0 commit comments