#!/usr/bin/env python
# coding: utf-8
# In[9]:
import collections
# In[10]:
counter=collections.Counter([1,1,2,2,3,3,3,3,4,5,6,7])
# In[11]:
counter
# In[12]:
counter.most_common(1)
# In[13]:
counter.most_common(2)
# In[14]:
counter.most_common(3)
# In[15]:
counter=collections.Counter("clcoding")
# In[16]:
counter
# In[18]:
counter["c"]
# In[19]:
counter.most_common(1)
# In[20]:
counter.most_common(2)
# In[21]:
counter=collections.Counter("ntirawen")
# In[22]:
counter
# In[23]:
counter2=collections.Counter("ntirawen")
# In[24]:
counter2
# In[25]:
counter3=collections.Counter("irawen")
# In[26]:
counter3
# In[27]:
counter2.subtract(counter3)
# In[28]:
counter2
# In[ ]:
0 Comments:
Post a Comment