# Code Project - time cauculator : Need help

Hello,
Right now I am trying to learn programming. So far I have not been successful in completing any task. For time calculator project this is my code:

``````def add_time(start, duration):
timevar =[]
duvar =[]
timevar = start.replace(" ",":").split(":")
duvar = duration.split(":")
#convert PM to 24 hour
if timevar == "PM":
convar = int(timevar) + 12
else: convar = int(timevar)
#calculate minute and convert minute
Total_minute = int(timevar) + int(duvar)
if Total_minute >60 :
Extra_hour = 1
Total_minute = Total_minute - 60
else: Extra_hour = 0
# calculate hour and convert hour
Total_hour = convar + int(duvar) + int(Extra_hour)
n_day = float((Total_hour/24) - 1)
if n_day <0 : p_day=" "
elif n_day >0 and n_day <1 : p_day= "(next day)"
else: p_day = f"({int(n_day)+1} days later)"
restime = Total_hour % 24
if restime >0.5 : ampm = "PM"
else: ampm = "AM"
if Total_hour > 24:
con_hour = Total_hour - ((int(n_day)+1)*24)
else: con_hour = Total_hour
if con_hour > 12:
Print_hour = con_hour - 12
else: Print_hour = con_hour
print (f"{Print_hour}:{Total_minute:02d} {ampm} {p_day}")
``````

and when I run the program this is my result

1:08 PM (next day)
None
3:07 PM
F6:18 PM (20 days later)
FE2:45 PM (next day)
F5:01 PM
F12:05 PM
F5:42 PM
FE2:59 PM (next day)
FE0:04 AM (2 days later)
FE

plus 8 failures and 4 errors.

While I suspect that 8 failures is more of a wrong calculation on my side, I am curious on why my 2nd line result in none and there are F or FE in front of my answers from line 3 and afterwards. Any suggestion or guidance would be appreciated. Thank you in advance.

Hey there Could you post a link to the lesson? It makes debugging so much easier.

Hi, this is the link for assignment.