SHARE
TWEET

Sum Seconds

Sim0o0na May 3rd, 2018 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top