[New-bugs-announce] [issue40809] list.Count() isn't working as expected for the series of same numbers in a list

chirag maliwal report at bugs.python.org
Thu May 28 12:33:22 EDT 2020


New submission from chirag maliwal <chiragmaliwal1995 at gmail.com>:

a = [1,1,1,1]

for i in a:
    if a.count(i) > 1:
        a.remove(i)
 
print(a)


"""
Output:
[1,1]


expected:
[1]
"""

----------
files: test.py
messages: 370239
nosy: cmaliwal
priority: normal
severity: normal
status: open
title: list.Count() isn't working as expected for the series of same numbers in a list
type: behavior
versions: Python 3.6
Added file: https://bugs.python.org/file49200/test.py

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40809>
_______________________________________


More information about the New-bugs-announce mailing list