Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- wagons = int(input()) * [0]
- command = input()
- while command != 'End':
- current = command.split(' ')
- if current[0] == 'add':
- wagons[len(wagons) - 1] += int(current[1])
- elif current[0] == 'insert':
- wagons[int(current[1])] += int(current[2])
- elif current[0] == 'leave':
- wagons[int(current[1])] -= int(current[2])
- command = input()
- print(wagons)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement