Hi @shedhe.bouhani,
Welcome to the Community!
It’s how the objects of the datetime.timedelta
class work. You can read more about it in this mission.
When we instantiate a timedelta class directly (i.e. create a datetime.timedelta
object), we can assign it any of the following parameters, according to the syntax:
datetime.timedelta(days=0, seconds=0, microseconds=0,
milliseconds=0, minutes=0, hours=0,
weeks=0)
When then we print the resulting object, it will be rendered automatically in days (if applicable), hours, minutes, and seconds. For example:
ten_seconds = dt.timedelta(seconds=10)
print(ten_seconds)
Output:
0:00:10
one_hour = dt.timedelta(seconds=3600)
print(one_hour)
Output:
1:00:00
one_more_hour = dt.timedelta(minutes=30, seconds=1800)
print(one_more_hour)
Output:
1:00:00
more_than_one_day = dt.timedelta(hours=22, minutes = 180, seconds=20000)
print(more_than_one_day)
Output:
1 day, 6:33:20
However, if we assign the parameters so that to have more than one week, it will still be rendered in days, and not weeks:
two_weeks = dt.timedelta(days=13, hours=24)
print(two_weeks)
Output:
14 days, 0:00:00
Returning to your mission screen, both min_length
and min_length
are the objects of datetime.timedelta
type. In the dictionary appt_lengths
they were assigned in seconds, now they are rendered in days (in case of max_length
), hours, minutes, and seconds.