Time Calculator Project Help

I am currently working on the time calculator project, here is my code:

def add_time(start, duration):
  clock, period = start.split()
  time, ap = start.split(" ")
  hour, minute = clock.split(":")
  addHour, addMinute = duration.split(":")
  newHour = int(hour) + int(addHour)
  newMin = int(minute) + int(addMinute)
  answer = str(newHour) + ":" + str(newMin) + " " + ap

return answer

To be honest, i am very confused and struggling on how to code this, I’m a newbie at programming, I’ve been learning from CSDojo and also freeCodeCamp. However, I found this project to be very hard and a bit impossible for such begginer considering the lesson that freeCodeCamp gave. Anyone has ony solution or tips for how to do this project and what should I do?
https://repl.it/@MichaelChristi2/boilerplate-time-calculator#time_calculator.py

do you want the loop to be inside the function or not?

repl.it is also telling about an indentation error


I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

oh thank you so much, yes i do think of putting the loop inside the function, i’ve already manage to addition the old hour and the new duration, but I’m super confused on how to make it so that if it goes more than 12 hour, it will add up to the minute. I’m still confused on how to do the AM/PM and how many days later as well