desislava_topuzakova

02. Lunch Break

Nov 14th, 2020
800
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.91 KB | None | 0 0
  1. # време за обяд = 1/8 от почивката
  2. # време за отдих = 1/4 от почивката
  3. # време за сериал
  4. # oбщо = време за обяд + време за отдих  + време за сериал
  5. import math
  6. movie_name = input()
  7. movie_time = int(input())
  8. lunch_break_time = int(input())
  9.  
  10. lunch_time = 1 / 8 * lunch_break_time # lunch_break_time / 8
  11. rest_time = 1 / 4 * lunch_break_time
  12.  
  13. total_time = lunch_time + rest_time + movie_time
  14.  
  15. # времето е достатъчно -> total_time <= lunch_break_time
  16. if total_time <= lunch_break_time:
  17.     left_time = math.ceil(lunch_break_time - total_time)
  18.     print(f"You have enough time to watch {movie_name} and left with {left_time} minutes free time.")
  19. else:
  20.     need_time = math.ceil(total_time - lunch_break_time)
  21.     print(f"You don't have enough time to watch {movie_name}, you need {need_time} more minutes.")
Advertisement
Add Comment
Please, Sign In to add comment