Advertisement
Guest User

Untitled

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