More readable code with comments:
```
from datetime import date
# The user enters the year, month and date
# There are hints on filling, but there are no checks if invalid data is entered
test_year = input('year of birth (example, 1989):')
test_month = input('month of birth (example, 01 or 12):')
test_date = input('date of birth (example, 01 or 31):')
# If the string is not in ISO format, we handle the exception
try:
# We glue the data into one line
test = f'{test_year}-{test_month}-{test_date}'
# We translate the string data into a date
birthday = date.fromisoformat(test)
# As a bonus, get the age from the difference between the current date and the date of birth
today = date.today()
years = (today - birthday).days // 365
# Zodiac signs and date boundaries for them
zodiac_signs = {
'Capricorn': (date(birthday.year, month=12, day=22), date(birthday.year, month=1, day=19)),
'Aquarius': (date(birthday.year, month=1, day=20), date(birthday.year, month=2, day=18)),
'Pisces': (date(birthday.year, month=2, day=19), date(birthday.year, month=3, day=20)),
'Aries': (date(birthday.year, month=3, day=21), date(birthday.year, month=4, day=19)),
'Taurus': (date(birthday.year, month=4, day=20), date(birthday.year, month=5, day=20)),
'Gemini': (date(birthday.year, month=5, day=21), date(birthday.year, month=6, day=20)),
'Cancer': (date(birthday.year, month=6, day=21), date(birthday.year, month=7, day=22)),
'Leo': (date(birthday.year, month=7, day=23), date(birthday.year, month=8, day=22)),
'Virgo': (date(birthday.year, month=8, day=23), date(birthday.year, month=9, day=22)),
'Libra': (date(birthday.year, month=9, day=23), date(birthday.year, month=10, day=22)),
'Scorpio': (date(birthday.year, month=10, day=23), date(birthday.year, month=11, day=21)),
'Sagittarius': (date(birthday.year, month=11, day=22), date(birthday.year, month=12, day=21))
}
# Determine the correspondence to the zodiac sign
# What date range does the date of birth fall into
for sign, (start_date, end_date) in zodiac_signs.items():
if start_date <= birthday <= end_date:
print('Date of birth:', birthday)
print('Zodiac sign:', sign)
print('Age:', years)
except ValueError as error:
print(error) # Invalid isoformat string: '1-1-1'
```
Result:
```
Date of birth: 2000-01-31
Zodiac sign: Aquarius
Age: 24
```
I can't offer a good check of the entered data, here only exception handling if the date string is not in ISO format. But here is a more understandable code for determining the zodiac sign. I accompanied it with comments. I hope someone will find it useful.
```
from datetime import date
# The user enters the year, month and date
# There are hints on filling, but there are no checks if invalid data is entered
test_year = input('year of birth (example, 1989):')
test_month = input('month of birth (example, 01 or 12):')
test_date = input('date of birth (example, 01 or 31):')
try:
# We glue the data into one line
# If the string is not in ISO format, we handle the exception
test = f'{test_year}-{test_month}-{test_date}'
# We translate the string data into a date
birthday = date.fromisoformat(test)
# As a bonus, get the age from the difference between the current date and the date of birth
today = date.today()
years = (today - birthday).days // 365
# Zodiac signs and date boundaries for them
zodiac_signs = {
'Capricorn': (date(birthday.year, month=12, day=22), date(birthday.year, month=1, day=19)),
'Aquarius': (date(birthday.year, month=1, day=20), date(birthday.year, month=2, day=18)),
'Pisces': (date(birthday.year, month=2, day=19), date(birthday.year, month=3, day=20)),
'Aries': (date(birthday.year, month=3, day=21), date(birthday.year, month=4, day=19)),
'Taurus': (date(birthday.year, month=4, day=20), date(birthday.year, month=5, day=20)),
'Gemini': (date(birthday.year, month=5, day=21), date(birthday.year, month=6, day=20)),
'Cancer': (date(birthday.year, month=6, day=21), date(birthday.year, month=7, day=22)),
'Leo': (date(birthday.year, month=7, day=23), date(birthday.year, month=8, day=22)),
'Virgo': (date(birthday.year, month=8, day=23), date(birthday.year, month=9, day=22)),
'Libra': (date(birthday.year, month=9, day=23), date(birthday.year, month=10, day=22)),
'Scorpio': (date(birthday.year, month=10, day=23), date(birthday.year, month=11, day=21)),
'Sagittarius': (date(birthday.year, month=11, day=22), date(birthday.year, month=12, day=21))
}
# Determine the correspondence to the zodiac sign
# What date range does the date of birth fall into
for sign, (start_date, end_date) in zodiac_signs.items():
if start_date <= birthday <= end_date:
print('Date of birth:', birthday)
print('Zodiac sign:', sign)
print('Age:', years)
except ValueError as error:
print(error) # Invalid isoformat string: '1-1-1'
```