Open jangjusung opened 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)
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)