Advertisement
exDotaPro

katmandu

Jul 29th, 2020
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.75 KB | None | 0 0
  1. import re
  2.  
  3. regex = r"([A-Za-z0-9!@#$?]+)=(\d+)<<(.+)"
  4.  
  5. while True:
  6.     line = input()
  7.  
  8.     if line == 'Last note':
  9.         break
  10.  
  11.     data = re.findall(regex, line)
  12.     name = ''
  13.  
  14.     if '=' in line:
  15.         name, _ = line.split('=')
  16.  
  17.     if data:
  18.         for match in data:
  19.             peak, length, coordinates = match[0], int(match[1]), match[2]
  20.             if peak == name and length == len(coordinates):
  21.                 current_peak = ''
  22.                 for char in peak:
  23.                     if char.isalpha():
  24.                         current_peak += char
  25.                 print(f'Coordinates found! {current_peak} -> {coordinates}')
  26.             else:
  27.                 print('Nothing found!')
  28.     else:
  29.         print('Nothing found!')
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement