pacho_the_python

Untitled

Mar 28th, 2022
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.70 KB | None | 0 0
  1. key = list(map(int, input().split()))
  2. treasure_data = input()
  3.  
  4. counter_key = 0
  5. while True:
  6.     if treasure_data == "find":
  7.         break
  8.     treasure_location = ""
  9.     counter_key = 0
  10.     for letter in treasure_data:
  11.         result = (ord(letter) - key[counter_key])
  12.         treasure_location += chr(result)
  13.         counter_key += 1
  14.         if counter_key == len(key):
  15.             counter_key = 0
  16.  
  17.     ore_location_data = treasure_location.split("&")
  18.     ore = ore_location_data[1]
  19.     location_data = ore_location_data[2]
  20.     location = location_data.split("<")
  21.     result = [x for x in location[1] if x != ">"]
  22.  
  23.     print(f'Found {ore} at {"".join(result)}')
  24.     treasure_data = input()
  25.  
Advertisement
Add Comment
Please, Sign In to add comment