Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- targets = list(map(int, input().split(' ')))
- command = input()
- while command != "End":
- command, index, value = command.split(' ')
- index = int(index)
- value = int(value)
- if command == "Shoot":
- if 0 <= index < len(targets):
- targets[index] -= value
- if targets[index] <= 0:
- targets.pop(index)
- elif command == "Add":
- if 0 <= index < len(targets):
- targets.insert(index, value)
- else:
- print("Invalid placement!")
- elif command == "Strike":
- if index - value >= 0 and index + value < len(targets):
- del targets[index - value: value + index + 1]
- else:
- print("Strike missed!")
- command = input()
- print('|'.join(map(str, targets)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement