Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Change -> zip*4 solution in Clear category for Keys and Locks by fed.kz
def keys_and_locks(lock, key):
def change(obj):
'''Delete null cols and rows'''
obj = [elem for elem in obj.split() if '#' in elem]
obj = [''.join(x) for x in zip(*obj)]
obj = [elem for elem in obj if '#' in elem]
obj = [''.join(x) for x in zip(*obj)]
return obj
lock = change(lock)
key = change(key)
for _ in range(4):
if key == lock: return True
key = [''.join(x) for x in zip(*key)][::-1]
return False
Sept. 13, 2018
Comments: