Тема: Перевірте код !
Привіт ! Перевірте код.
-----НЕ ПРАВИЛЬНИЙ КОД(який мені треба було редагувати !) ----
# Step 1
start import datetime
# Step 2
birth day = int(input("Day of birth: "))
birth month = int(input("Month of birth: "))
birth year = int(input("Year of birth: "))
day = int(datetime.date.today().day)
month = int(datetime.date.today().month)
year = int(datetime.date.today().year)
# Step 3
if * > **:
age = year - birth_year
then:
age = (year - birth_year) - 1
# Step 4
a = age
b = abs(month - birth_month)
c = abs(day - birth_day)
print("Your age: {a} years, {b} months, {c} days")
-------ПРАВИЛЬНИЙ КОД який будьласка перевірте !---
import datetime
# Step 2
birth_day = int(input("Day of birth: "))
birth_month = int(input("Month of birth: "))
birth_year = int(input("Year of birth: "))
day = int(datetime.date.today().day)
month = int(datetime.date.today().month)
year = int(datetime.date.today().year)
# Step 3
if year > birth_year:
age = year - birth_year
else:
age = (year - birth_year) - 1
# Step 4
a = age
b = abs(month - birth_month)
c = abs(day - birth_day)
print(f"Your age: {a} years, {b} months, {c} days")