 # Boilerplate-time-calculator

‘’’
Scientific Computing with Python Projects, I wrote the code that achieves every single case mentioned in the README.md file, but it did not pass the unite test, I need help.
type or paste code here

``````def convert24(str1):
try:
clock, period = str1.split()
except:
return str1

hours, minutes = clock.split(":")
# Checking if last two elements of time
# is AM and first two elements are 12
if period == "AM" and hours == "12":
return "00" + minutes

# remove the AM
elif period == "AM":
return clock

# Checking if last two elements of time
# is PM and first two elements are 12
elif period == "PM" and hours == "12":
return clock

else:

# add 12 to hours and remove PM
t=int(hours) + 12
return f'{t}:{minutes}'

new_time= convert24(time)
new_duration= convert24(duration)
new_time_hours, new_time_minutes= new_time.split(':')
new_duration_hours, new_duration_minutes= new_duration.split(':')
total_hours= int(new_time_hours)+ int(new_duration_hours) +int((int(new_time_minutes)+ int(new_duration_minutes))/60)
total_minutes= (int(new_time_minutes)+ int(new_duration_minutes))%60
return f'{total_hours}:{total_minutes}'

def days_counter(time):
time_hours, time_minutes=time.split(':')
counter= int(int(time_hours)/24)
remain_hours= int(time_hours)%24
massege= str()
if counter ==0:
return time
elif counter == 1:
massege = "next day"
else:
massege = f'{counter} day later'

return (f'{remain_hours}:{time_minutes}', f'({massege})')

def convert12(str1):
time_hours,time_minutes = str1.split(':')
result_hours=int(time_hours)%12
period = int(int(time_hours)/12)
if period == 0:
period = "AM"
else:
period = "PM"
return f'{result_hours}:{time_minutes} {period}'