# Time calculator, i really need help

so im doing the time calculator, but im getting a few bugs and my days are always 1 short, like if its 20 days ahead it reports 19 days ahead, please look into the code and help me. I will be very grateful! (im asking after trying to work it out for 3 days)

def add_time(start, duration, day = “Monday”):
days_of_week = {“monday”: 0, “tuesday”: 1, “wednesday”: 2, “thursday”: 3, “friday”: 4, “saturday”: 5, “sunday”: 6}
days_of_week_list = [“Monday”, “Tuesday”, “Wednesday”, “Thursday”, “Friday”, “Saturday”, “Sunday”]

``````# seperating start time
start_tuple = start.partition(":")
start_minutes_tuple = (start_tuple[2].partition(" "))
start_hour = int(start_tuple[0])
start_minute = int(start_minutes_tuple[0])

# seperating duration time
duration_tuple = duration.partition(":")
duration_hour = int(duration_tuple[0])
duration_minute = int(duration_tuple[2])

#ampm info
am_pm = start_minutes_tuple[2]
num_of_ampm_flips = int((start_hour + duration_hour) / 12)
am_pm_flip_dict = {"AM": "PM", "PM": "AM"}
num_of_days = int(duration_hour / 24)

output_minutes = (start_minute + duration_minute)%60
if output_minutes  >= 60:
start_hour = start_hour + 1
if output_minutes < 10:
output_minutes = str(output_minutes)
output_minutes = "0" + output_minutes
if output_minutes == 0:
output_minutes = "00"

output_hours = (start_hour + duration_hour)%12
if output_hours == 0:
output_hours = str(output_hours)
output_hours = "1"

# calculating am pm
am_pm = am_pm_flip_dict[am_pm] if num_of_ampm_flips % 2 == 1 else am_pm
if (am_pm == "PM" and start_hour + (duration_hour % 12) >= 12):
num_of_days +=1
output_hours = str(output_hours)
output_minutes= str(output_minutes)

day = day.lower()
index_for_day = int((days_of_week[day]) + num_of_days) % 7
new_day = days_of_week_list[index_for_day]

#output function
returnTime = str(output_hours) + ":" + str(output_minutes) + " " + am_pm + "," +" " + str(new_day) + " " + "(" + str(num_of_days) + " days later" + ")"

print(returnTime)
``````

User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36`

Challenge: Time Calculator