classification
Title: Issue found during language name processing in a list
Type: behavior Stage: resolved
Components: Versions:
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: AjaySyam, steven.daprano, terry.reedy, xtreak
Priority: normal Keywords:

Created on 2019-08-30 11:02 by AjaySyam, last changed 2019-08-31 01:17 by terry.reedy. This issue is now closed.

Files
File name Uploaded Description Edit
IMG_20190830_162306__1567162571_88362.jpg AjaySyam, 2019-08-30 11:02 screenshot of the unproper working of language name Malayalam in a list
Messages (4)
msg350869 - (view) Author: SYAM PARAKASH,AJAY KUMAR (AjaySyam) Date: 2019-08-30 11:02
I found an error in processing language name like Malayalam,English.. in a list created using Python 3.6.1
msg350871 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python triager) Date: 2019-08-30 11:38
Can you please attach the code snippet as text instead of screenshot so that it would be helpful to copy paste and run. In the issue please add a description of what's the output you are expecting and what's the actual output?

Thanks
msg350872 - (view) Author: Steven D'Aprano (steven.daprano) * (Python committer) Date: 2019-08-30 11:46
It may help if you read this:

http://sscce.org/

It is written for Java programmers but it applies to Python as well.

Don't expect us to re-type your code from a hard-to-read, out-of-focus, low-resolution photo of your monitor. Copy and paste the code into a .py file and attach that to this issue.

Don't expect us to guess what the error is. Copy and paste the entire traceback, if there is one. If there is no traceback, explain why you think there is an error:

- what data did you use?
- what results did you expect?
- what results did you get?
- what reason do you have for saying that it is a bug in Python rather than a bug in your own code?
msg350903 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-08-31 01:17
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.
History
Date User Action Args
2019-08-31 01:17:42terry.reedysetstatus: open -> closed

nosy: + terry.reedy
messages: + msg350903

resolution: not a bug
stage: resolved
2019-08-30 11:46:47steven.dapranosetnosy: + steven.daprano
messages: + msg350872
2019-08-30 11:38:25xtreaksetnosy: + xtreak
messages: + msg350871
2019-08-30 11:02:37AjaySyamcreate