Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Two list - two for ... solution in Clear category for The Hidden Word by maksimus
from itertools import zip_longest
def checkio(text, word):
L1 = [''.join([t for t in s.split()]).lower() for s in text.split("\n")]
L2 = [''.join(t).lower() for t in list(zip_longest(*L1, fillvalue='?'))]
R = False
for i in range(len(L1)):
if word in L1[i]:
R = [i+1, L1[i].find(word)+1, i+1, L1[i].find(word)+len(word)]
for j in range(len(L2)):
if word in L2[j]:
R = [L2[j].find(word)+1, j+1, L2[j].find(word)+len(word), j+1]
return R
March 4, 2021