Commit 1dc11b66 by likorn

Fixed one more endless mistake with the age

parent 6b664aab
Showing with 8 additions and 7 deletions
......@@ -11,13 +11,15 @@ b_day = datetime.date(year, month, day)
next_b_day = datetime.date(today.year+1, b_day.month, b_day.day)
age = today.year - b_day.year
print("You're "+str(age)+" years old")
if (b_day.month == today.month) and (b_day.day == today.day):
print("Happy b-day!")
elif b_day.month >= today.month :
next_b_day = datetime.date(today.year, b_day.month, b_day.day)
else:
next_b_day = datetime.date(today.year + 1, b_day.month, b_day.day)
days_left = next_b_day - today
print("There're "+str(days_left)+" left")
\ No newline at end of file
if b_day.month >= today.month:
next_b_day = datetime.date(today.year, b_day.month, b_day.day)
age = age - 1
else:
next_b_day = datetime.date(today.year + 1, b_day.month, b_day.day)
days_left = next_b_day - today
print("There're " + str(days_left) + " left")
print("You're "+str(age)+" years old")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment