jangjusung / jusung-python

0 stars 0 forks source link

숫자 카운트 #4

Open jangjusung opened 2 years ago

jangjusung commented 2 years ago

from collections import Counter seq1=[1,2,3,1,3,4,5,1,5,1,2,3,4,5,1,2,3,1] seq_counts=Counter(seq1) print(seq_counts)

seq2=[1,2,3] seq_counts.update(seq2) print(seq_counts)

seq3=[1,4,3,100,100] for key in seq3: seq_counts[key]+=1 print(seq_counts)

seq_counts_2=Counter(seq3) print(seq_counts_2) print(seq_counts+seq_counts_2) print(seq_counts-seq_counts_2)