Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Use ljust() to fill lines with 0 so they have eq len. solution in Clear category for The Hidden Word by quarkov
def checkio(text, word):
text = text.lower().replace(" ", "").split("\n")
longest = len(max(text, key=len))
for i in range(len(text)):
text[i] = text[i].ljust(longest, "0")
for line in text:
if word in line:
return [text.index(line) + 1, line.index(word) + 1, text.index(line) + 1, line.index(word) + len(word)]
for i in range(len(line)):
if line[i] == word[0]:
compare = line[i]
row = text.index(line)
col = i
if len(text) - row >= len(word):
for j in range(row + 1, row + len(word)):
compare += text[j][col]
if compare == word:
return [row + 1, col + 1, row + len(word), col + 1]
return []
Sept. 13, 2018