Skip to content

Commit b800c09

Browse files
Merge pull request #1969 from Nayan808/AgeCalc
Modified Script of age Calculator
2 parents e55a24f + e667b30 commit b800c09

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Age_Calculator/Age_Calculator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ def calculate_age(birthday):
99

1010
day_check = ((today.month, today.day) < (birthday.month, birthday.day))
1111
year_diff = today.year - birthday.year - day_check
12-
remaining_months = abs(today.month - birthday.month)
12+
remaining_months = abs((12-birthday.month)+today.month)
1313
remaining_days = abs(today.day - birthday.day)
1414

1515
# Return the age as a formatted string
1616
age_string = f"Age: {year_diff} years, {remaining_months} months, and {remaining_days} days"
1717
return age_string
1818

1919
if __name__ == "__main__":
20-
print("Simple Age Calculator")
20+
print(" Age Calculator By Python")
2121

2222
try:
2323
birthYear = int(input("Enter the birth year: "))

0 commit comments

Comments
 (0)