Advertisement
Guest User

On time for the exam

a guest
Nov 22nd, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.87 KB | None | 0 0
  1. exam_h = int(input())
  2. exam_min = int(input())
  3. arrival_h = int(input())
  4. arrival_min = int(input())
  5.  
  6.  
  7. exam_time_in_min = exam_h*60 + exam_min
  8.  
  9. arrival_time_in_min = arrival_h*60 + arrival_min
  10.  
  11. diff = exam_time_in_min - arrival_time_in_min
  12.  
  13.  
  14. if diff < 0:
  15.     print("Late")
  16.     diff = abs(diff)
  17.     if diff>=60:
  18.         hours = diff//60
  19.         minutes = diff % 60
  20.         print('{}:{:02d} hours after the start'.format(hours, minutes))
  21.        
  22.     else:
  23.         print(f'{diff} minutes after the start')
  24. elif 0<=diff<=30:
  25.     print("On time")
  26.     if diff > 0:
  27.         print(f'{diff} minutes before the start')
  28. elif diff >30:
  29.     print("Early")
  30.     if diff>=60:
  31.         hours = diff//60
  32.         minutes = diff % 60
  33.         print('{}:{:02d} hours before the start'.format(hours, minutes))
  34.        
  35.     else:
  36.         print(f'{diff} minutes before the start')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement