Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Mono Captcha by tokiojapan55
from typing import List
FONT = ("00100111011101010111001101110111001101100"
"01100001000101010100010000010101010101010"
"00100011001001110110011100100111011101010"
"00100100000100010001010101000101000101010"
"00100111011100010110001101000111011000110")
def checkio(image: List[List[int]]) -> int:
result = 0
for pos in range(len(image[0])//4):
error = {n:0 for n in range(10)}
for n in range(10):
for r,c in [(r,c) for r in range(5) for c in range(3)]:
if image[r][1+pos*4+c]!=int(FONT[r*41+1+n*4+c]):
error[(n+1)%10] += 1
result = result*10 + sorted(error, key=lambda n:error[n])[0]
return result
May 29, 2020