zaxooooo

Fundamentals module Task 2

Feb 25th, 2021
479
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. targets = [int(el) for el in input().split()]
  2.  
  3. index = input()
  4. counter_shot_targets = 0
  5.  
  6. while not index == "End":
  7.     index = int(index)
  8.  
  9.     if index not in range(len(targets)):
  10.         index = input()
  11.         continue
  12.  
  13.     current_value = targets[index]
  14.  
  15.     if current_value == -1:
  16.         index = input()
  17.         continue
  18.  
  19.     targets[index] = -1
  20.     counter_shot_targets += 1
  21.  
  22.     for current_index in range(len(targets)):
  23.         if targets[current_index] == -1:
  24.             continue
  25.         if targets[current_index] > current_value:
  26.             targets[current_index] -= current_value
  27.         else:
  28.             targets[current_index] += current_value
  29.  
  30.     index = input()
  31.  
  32. print(f"Shot targets: {counter_shot_targets} -> {' '.join([str(el) for el in targets])}")
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×