Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def lookForMatch(strn, dct):
- for line in dct:
- if len(strn) > len(line):
- comp_flag = False
- k = 0
- while (len(line) + k <= len(strn)):
- zero_count = strn.count("0")
- for i in range(len(line)):
- if strn[i+k] == line[i] or strn[i+k] == '0':
- if strn[i+k] == "0":
- zero_count -= 1
- else:
- comp_flag = True
- else:
- comp_flag = False
- break
- if comp_flag and not zero_count:
- return line
- k += 1
- else:
- continue
- return "NONEXIST"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement