Terry J. Reedy <tjre...@udel.edu> added the comment:
This code derived from the blurry image lst = ['malaysian', 'malayalam', 'aaaaaaaaa'] ip = input('word ') li = len(ip) miss = 0 for word in lst: if len(word) == li: for j in range(li-1): # skip last because of lookahead if word[j] != ip[j] and word[j+1] != ip[j]: miss += 1 if miss < li/2: print(word) run with 3.8.0b4 on Win10 in IDLE prints the expected output. word malayalam malaysian malayalam I leave it to you to find out why you got something different and to play with variations. Please direct any questions to python-list or similar forums, as they will almost certainly be off-topic here. And do follow the advice about question format and providing code as text. Steven, the code ran without error in PyCharm, but gave no matches. I presume that the 'error' was not matching 'malaysian' even though the miss count 4 is less than 4.5. I must have corrected something when reading the blurs and polishing the code. ---------- nosy: +terry.reedy resolution: -> not a bug stage: -> resolved status: open -> closed _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue37988> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com