zhukov000

Подбор кодов

Nov 22nd, 2021
834
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. from itertools import product
  2.  
  3. def check(t):
  4.     for e in ["11", "1000", "0010", "0000", "010", "0001", "1001", "0011", "0111"]:
  5.         if e.startswith(t) or t.startswith(e):
  6.             return False
  7.     return True
  8.  
  9. for i in range(1, 5):
  10.     # перебор кодов
  11.     for t in product("01", repeat=i):
  12.         code = "".join(t)
  13.         if check(code):
  14.             print(code)
  15.  
Advertisement
Add Comment
Please, Sign In to add comment