Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- targets_list = list(map(int, input().split())) # 24 50 36 70
- while True:
- command = input()
- if command == "End":
- break
- if command.isdigit():
- target_index = int(command)
- if target_index < len(targets_list):
- shot_target = int(targets_list[target_index])
- targets_list.pop(target_index)
- targets_list.insert(target_index, int(-1))
- for i, target in enumerate(targets_list):
- if target == -1:
- continue
- elif shot_target >= target:
- targets_list[i] += shot_target
- elif shot_target < target:
- targets_list[i] -= int(shot_target)
- else:
- continue
- count = 0
- for t in targets_list:
- if t == -1:
- count += 1
- print(f"Shot targets: {count}", end=" -> ")
- targets_list = list(map(str, targets_list))
- print(" ".join(targets_list))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement