Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- number_of_people = int(input())
- steps = int(input())
- counter = 1
- people_in = 0
- people_out = 0
- total_people_bus = 0
- while counter <= steps:
- people_out = int(input())
- people_in = int(input())
- if counter % 2 != 0:
- people_bus = number_of_people + people_in + 2 - people_out
- else:
- people_bus = number_of_people + people_in - 2 - people_out
- counter += 1
- number_of_people = people_bus
- print(f"The final number of passengers is : {number_of_people}")
Advertisement
Add Comment
Please, Sign In to add comment