desislava_topuzakova

05. Time + 15 Minutes

Apr 26th, 2020
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.58 KB | None | 0 0
  1. # часове и минути
  2. # превърнем само в минути
  3. # добавим 15
  4. # превърнем в часове и минути
  5. # печатаме
  6.  
  7. now_hour = int(input())
  8. now_minutes = int(input())
  9.  
  10. now_in_minutes = now_hour * 60 + now_minutes # 1439
  11. time_after_15_minutes = now_in_minutes + 15 # 1454
  12.  
  13. final_hour = time_after_15_minutes // 60 # 24
  14. final_minutes = time_after_15_minutes % 60
  15.  
  16. if final_hour == 24:
  17.     final_hour = 0
  18.  
  19. if final_minutes < 10:
  20.     print(f'{final_hour}:0{final_minutes}')
  21. else:
  22.     print(f'{final_hour}:{final_minutes}')
Add Comment
Please, Sign In to add comment