Sim0o0na

Sum Seconds

May 3rd, 2018
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.47 KB | None | 0 0
  1. # 1. Read input (seconds)
  2. first_time = int(input())
  3. second_time = int(input())
  4. third_time = int(input())
  5.  
  6. # 2. Sum input
  7.  
  8. sum_seconds = first_time + second_time + third_time
  9.  
  10. minutes = sum_seconds // 60
  11. seconds = sum_seconds % 60
  12.  
  13. # 4. Check if seconds < 10 -> leading zero
  14. #       a: print minutes + :0 + seconds
  15. #       b: print minutes + :second
  16.  
  17. if seconds < 10:
  18.     print(str(minutes) + ':0' + str(seconds))
  19. else:
  20.     print(str(minutes) + ':' + str(seconds))
Add Comment
Please, Sign In to add comment