Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sugar_cubes = list(map(int, input().split()))
- command = input().split()
- while not command[0] == "Mort":
- if command[0] == "Add":
- value = command[1]
- sugar_cubes.append(value)
- elif command[0] == "Remove":
- value = int(command[1])
- if value in sugar_cubes:
- sugar_cubes.remove(value)
- elif command[0] == "Replace":
- value = int(command[1])
- replacement = int(command[2])
- sugar_cubes = [replacement if el == value else el for el in sugar_cubes]
- elif command[0] == "Collapse":
- value = int(command[1])
- for el in range(1, sugar_cubes + 1):
- if el < value:
- sugar_cubes.remove(el)
- command = input().split()
- print(" ".join(map(str, sugar_cubes)))
Advertisement
Add Comment
Please, Sign In to add comment