Advertisement
Guest User

Untitled

a guest
Nov 12th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.91 KB | None | 0 0
  1. ef lookForMatch(strn, dct):
  2.     oh_str = ""
  3.     for line in dct:
  4.         if len(strn) > len(line):
  5.             comp_flag = False
  6.             k = 0
  7.             while (len(line) + k <= len(strn)):
  8.                 zero_count = strn.count("0")
  9.                 for i in range(len(line)):
  10.                     if strn[i+k] == line[i] or strn[i+k] == '0':
  11.                         if strn[i+k] == "0":
  12.                             zero_count -= 1
  13.                             oh_str += "0"
  14.                         else:
  15.                             comp_flag = True
  16.                             oh_str += line[i]
  17.                     else:
  18.                         comp_flag = False
  19.                         oh_str = ""
  20.                         break
  21.                 if comp_flag and not zero_count:
  22.                     return (line, oh_str)
  23.                 k += 1
  24.         else:
  25.              continue
  26.     return ("NONEXIST", "")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement