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