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