Advertisement
tod36

09. On Time for the Exam

Jan 31st, 2020
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.93 KB | None | 0 0
  1. hour_exam = int(input())
  2. min_exam = int(input())
  3. hour_stu = int(input())
  4. min_stu = int(input())
  5. hh = 0
  6. mm = 0
  7.  
  8.  
  9. if hour_exam == (hour_stu + 1):
  10.     if min_exam < min_stu:
  11.         mm = min_exam + (60 - min_stu)
  12.     else:
  13.         hh = hour_exam - hour_stu
  14.         mm = min_stu - min_exam
  15.         if mm == 0:
  16.             print("Early")
  17.             print(f"{hh}:{mm:02d} hours before the start")
  18.         else:
  19.             pass
  20.     if min_exam == 0 and mm != 0:
  21.         mm = 60 - min_stu
  22.         print("On time")
  23.         if min_stu == 00:
  24.             pass
  25.         else:
  26.             print(f"{mm:02d} minutes before the start")
  27.     else:
  28.         if hour_exam == hour_stu:
  29.             print("Early")
  30.             print(f"{mm:02d} minutes before the start")
  31.         elif min_exam != min_stu:
  32.             print("Early")
  33.             print(f"{mm:02d} minutes before the start")
  34. elif hour_exam == hour_stu:
  35.     mm = min_exam - min_stu
  36.     if 0 <= mm <= 30:
  37.         if min_exam == 0:
  38.             mm = 60 - min_stu
  39.             print("On time")
  40.             if min_stu == 00:
  41.                 pass
  42.             else:
  43.                 print(f"{mm:02d} minutes before the start")
  44.         else:
  45.             print("Early")
  46.             print(f"{mm:02d} minutes before the start")
  47.     elif 30 < mm < 59:
  48.         print("Early")
  49.         print(f"{mm:02d} minutes before the start")
  50.     elif mm < 0:
  51.         print("Late")
  52.         print(f"{abs(mm):02d} minutes after the start")
  53. elif hour_exam > hour_stu:
  54.     hh = hour_exam - hour_stu
  55.     mm = min_stu - min_exam
  56.     print("Early")
  57.     print(f"{hh}:{abs(mm):02d} hours before the start")
  58. else:
  59.     if min_stu < min_exam:
  60.         mm = min_stu + (60 - min_exam)
  61.         print("Late")
  62.         print(f"{mm:02d} minutes after the start")
  63.     else:
  64.         hh = hour_stu - hour_exam
  65.         mm = min_stu - min_exam
  66.         print("Late")
  67.         print(f"{hh}:{abs(mm):02d} hours after the start")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement