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.)
month = int(datetime.date.)
year = int(datetime.date.)
# 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")

найти и исправить ошибку пожлуйста))

nikitastepanov21 nikitastepanov21    1   09.11.2019 13:54    32

Ответы
asdldks asdldks  10.10.2020 12:01

import datetime

from calendar import monthrange

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)

if birth_month <= month:

   if birth_day <= day:

       a = year - birth_year

       b = abs(month - birth_month)

       c = abs(day - birth_day)

   else:

       a = (year - birth_year) - 1

       b = 11 - abs(month - birth_month)

       c = monthrange(year, month)[1] - abs(day - birth_day)

else:

   a = (year - birth_year) - 1

   b = 11 - abs(month - birth_month)

   c = monthrange(year, month)[1] - abs(day - birth_day)

print("Your age: {} years, {} months, {} days".format(a,b,c))

Объяснение:

ПОКАЗАТЬ ОТВЕТЫ
Другие вопросы по теме Информатика