Learn Python like a Professional! Take You from 0 to Hero
In this Python lecture, we will learn about the Python Counter function
Counter() in python
"Counter is a function within collections module. It returns the occurrence of the elements "
Counter() in python
Let's see some example-
from collections import Counter
s='aaaaabbbccdddaa'
Counter(s)
l=[1,1,1,2,2,3,3,3,3,3,3,4,4,4,5,5,5,5,2,2]Counter(l)
>> Counter({1: 3, 2: 4, 3: 6, 4: 3, 5: 4})
t=(1,1,1,2,2,3,3,3,3,3,3)
Counter(t)
In the next Blog, we will discuss regular expression
https://sngurukuls247.blogspot.com/2018/12/python-ninja-bootcamp-40-regular.html
......................................................................................................................................
Instagram-
https://www.instagram.com/python.india/
View the Jupyter Notebook for this lecture
Download the Jupyter Notebook for this lecture
https://sngurukuls247.blogspot.com/2018/12/python-ninja-bootcamp-40-regular.html
......................................................................................................................................
Follow the link below to access Free Python Lectures-
https://www.youtube.com/channel/UCENc9qI7_r8KMf6-_1R1xnwInstagram-
https://www.instagram.com/python.india/
View the Jupyter Notebook for this lecture
Feel free contact me on-
Email - sn.gurukul24.7uk@gmail.com
No comments:
Post a Comment