aneliabogeva

Bus

Jun 10th, 2019
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. number_of_people = int(input())
  2. steps = int(input())
  3. counter = 1
  4. people_in = 0
  5. people_out = 0
  6. total_people_bus = 0
  7.  
  8. while counter <= steps:
  9. people_out = int(input())
  10. people_in = int(input())
  11. if counter % 2 != 0:
  12. people_bus = number_of_people + people_in + 2 - people_out
  13. else:
  14. people_bus = number_of_people + people_in - 2 - people_out
  15. counter += 1
  16. number_of_people = people_bus
  17. print(f"The final number of passengers is : {number_of_people}")
Advertisement
Add Comment
Please, Sign In to add comment