Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sequence_of_targets = [int(x) for x in input().split()]
- command = input()
- while command != 'End':
- command_type, index, damage = [x for x in command.split()]
- index = int(index)
- damage = int(damage)
- if command_type == 'Shoot':
- if 0 <= index < len(sequence_of_targets):
- sequence_of_targets[index] -= damage
- if sequence_of_targets[index] <= 0:
- sequence_of_targets.remove(sequence_of_targets[index])
- # del sequence_of_target[index]
- elif command_type == 'Add':
- if 0 <= index < len(sequence_of_targets):
- sequence_of_targets.insert(index, damage)
- else:
- print("Invalid placement!")
- elif command_type == 'Strike':
- start_radius = index - damage
- end_radius = index + damage + 1
- if 0 <= start_radius < end_radius < len(sequence_of_targets):
- for _ in range(start_radius, end_radius):
- sequence_of_targets.remove(sequence_of_targets[start_radius])
- else:
- print("Strike missed!")
- command = input()
- print(*sequence_of_targets, sep= "|")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement