Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def validaYSuma(hora):
- for i in range(len(hora)):
- hora[i] = int(hora[i])
- if -1<hora[2]<60 and -1<hora[1]<60 and -1<hora[0]<24:
- print('\n'+str(hora[0])+':'+str(hora[1])+':'+str(hora[2])+'hs es un horario valido!')
- #s
- if (hora[2]+1)//60>0:
- hora[2] += 1
- hora[2] %= 60
- #m
- if (hora[1]+1)//60>0:
- hora[1] += 1
- hora[1] %= 60
- #h
- if (hora[0]+1)//24>0:
- hora[0] += 1
- hora[0] %= 24
- else:
- hora[0]+=1
- else:
- hora[1]+=1
- else:
- hora[2]+=1
- for i in range(len(hora)):
- hora[i] = str(hora[i])
- r = hora
- else:
- r = 0
- print('\nError: Horario no valido!\n')
- return r
- #main
- print('|CALCULADOR DE SEGUNDO SIGUIENTE|\n')
- hora=validaYSuma(input('Ingrese hora de la forma "hh:mm:ss" (24hs): ').split(':'))
- if hora != 0:
- print('\nHora en el segundo siguiente -> '+hora[0]+':'+hora[1]+':'+hora[2]+'hs.')
- print('\nFin de la ejecucion!\n')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement