Answers for "python duplicate list"

1

duplicate in list python

a = [1,2,3,2,1,5,6,5,5,5]

import collections
print([item for item, count in collections.Counter(a).items() if count > 1])

## [1, 2, 5]
Posted by: Guest on May-21-2020
1

copy one list to another python

thislist = ["apple", "banana", "cherry"]
mylist = thislist.copy()
print(mylist)
Posted by: Guest on May-17-2020
0

python copy list

a=[1,2,3,4]
b=a[:] 
''' now b has all elements of  a'''
Posted by: Guest on September-29-2020

Python Answers by Framework

Browse Popular Code Answers by Language