# Not sure why Im returning that may errors - Time Calculator freecodecamp

My code is as follows but is returning errors on things that come our correct, not sure what is going on

``````def add_time(start, duration):
am_pm = start.split()[-1]
if am_pm == "AM":
start_h = int((start.split()[0]).split(":")[0])*60
else:
start_h = (int((start.split()[0]).split(":")[0])+12)*60
start_m = int((start.split()[0]).split(":")[-1])
dur_h = int(duration.split(":")[0])*60
dur_m = int(duration.split(":")[-1])
start_both = start_h + start_m
dur_both = dur_h + dur_m
end_h24 = 0
end_h12 = 0
end_m = 0
end_time = 0
days_later = 0
end_str = ""

if (start_both + dur_both) > 1444:
end_time = (start_both + dur_both)
end_h24 = int((start_both + dur_both)/60)%24
end_m = ((start_both + dur_both)%60)
days_later = int((start_both + dur_both)/(24*60))
if end_h24 > 11:
am_pm = "PM"
else:
am_pm = "AM"
elif (start_both + dur_both) > 720:
end_time = (start_both + dur_both)
end_h24= int((start_both + dur_both)/60)
end_m = ((start_both + dur_both)%60)
if end_h24 > 11:
am_pm = "PM"
else:
am_pm = "AM"
else:
end_time = (start_both + dur_both)
end_h24 = int((start_both + dur_both)/60)
end_m = ((start_both + dur_both)%60)
if end_h24 > 11:
am_pm = "PM"
else:
am_pm = "AM"

if days_later > 1:
end_str = "(" + str(days_later)+" days later)"
elif days_later > 0:
end_str = "(next day)"
else:
end_str = ""

if end_h24 > 12:
end_h12 = end_h24 - 12
else:
end_h12 = end_h24

if len(str(end_m)) > 1:
print(str(end_h12)+ ":"+ str(end_m)+ " "+ am_pm +" "+ end_str)
else:
print(str(end_h12)+ ":0"+ str(end_m)+ " "+ am_pm +" "+end_str)`````````

I don’t see any return statement in your code

hi there, the url to the project is https://www.freecodecamp.org/learn/scientific-computing-with-python/scientific-computing-with-python-projects/time-calculator

to your project, that’s just the explanation page on fcc

the repl on which you are coding

your code returns Null, you need return statements in your code to give an output to the function

i switched the print statements and added a return but still getting a lot of errors

there are two types of error from your code, one is this:

`TypeError: add_time() takes 2 positional arguments but 3 were given`

your code can’t handle functions like `add_time("11:30 AM", "2:32", "Monday")`

the other type of error is `AssertionError: None != '...'`

your function still returns `None`, as that is the output from the `print` statement