from collections import deque mydquene = deque() mylist = [0,1,1,2,2,3,3,3,3,4,5,6,7,7,8,8,9,10,10,11,22,33,22] mydquene.extend(mylist) for i in set(mylist): n = mydquene.count(i) if n>1: print("其中元素{}出现了{}次\r\n".format(i,n))
2023-12-11 22:04:27
from collections import deque mydquene = deque() mylist = [0,1,1,2,2,3,3,3,3,4,5,6,7,7,8,8,9,10,10,11,22,33,22] mydquene.extend(mylist) for i in set(mylist): n = mydquene.count(i) if n>1: print("其中元素{}出现了{}次\r\n".format(i,n))