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