Tell us what’s happening:
Describe your issue in detail here.
Your code so far
what’s the issues of the code
def add_time(start, duration,*args):
star_index = start.find(':')
dura_index = duration.find(':')
hours_star = int(start[:star_index])
minites_star = int(start[star_index+1:star_index+3])
hours_dura = int(duration[:dura_index])
minites_dura = int(durtion[dura_index+1:])
newhour = hours_star + hours_dura
newminites =minites_star + minites_dura
L = ['Sunday','Monday','Thuesday','Wednesday','Thursday','Friday','Saturday']
index1 = l.find(*args)
if newminites > 60:
newhour +=1
newminites = newminites - 60
start.replace(start[star_index+1:star_index+3],str(nweminites))
if start.find('AM') is True:
def hour_define1(newhour):
if newhour > 12 and newhour < 24:
n = newhour // 24
newhour -= 12
start.replace('AM','PM')
elif newhour >= 24 and newhour < 36:
n = newhour // 24
newhour -= 24
elif nehour >= 36 and newhour < 48:
n = newhour // 24
newhour -= 36
start.replace('AM','PM')
elif newhour >= 48:
n = newhour // 24
newhour %= 24
hour_define1(newhour)
return newhour,n
hour_define1(newhour)
start.replace(start[:star_index],str(newhour))
elif start.find('PM') is True:
def hour_define2(newhour):
if newhour > 12 and newhour < 24:
n = newhour // 24
newhour -= 12
start.replace('PM','AM')
elif newhour >= 24 and newhour < 36:
n = newhour // 24
newhour -= 24
elif nehour >= 36 and newhour < 48:
n = newhour // 24
newhour -= 36
start.replace('PM','AM')
elif newhour >= 48:
n = newhour // 24
newhour %= 24
hour_define1(newhour)
return newhour,n
hour_define1(newhour)
start.replace(start[:star_index],str(newhour))
if n == 0:
new_time = start + ' ' + *args
elif n == 1:
index1 = (index1 + 1) % len(L)
args = L[index1]
new_time = f'{start} {args} (next day)'
elif n >= 2:
index1 = (index1 + n) % len(L)
args = L[index1]
new_time = f'{start} {args} ({n} days later)'
return new_time
print(add_time('3:30 PM', '2:12'))
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36
Challenge Information:
Scientific Computing with Python Projects - Time Calculator
https://www.freecodecamp.org/learn/scientific-computing-with-python/scientific-computing-with-python-projects/time-calculator