count() to get number of matching items

All list methods

count() takes one argument.

returns number of matching value.
print("Number of times a appears : ", my_list.count('a'))
print("Number of times b appears : ", my_list.count('b'))
print("Number of times c appears : ", my_list.count('c'))
Number of times a appears :  2
Number of times b appears :  2
Number of times c appears :  1
All list methods Questions with solutions on List pop() to remove item based on position
Subscribe to our YouTube Channel here


* indicates required
Subscribe to plus2net

    Post your comments , suggestion , error , requirements etc here

    Python Video Tutorials
    Python SQLite Video Tutorials
    Python MySQL Video Tutorials
    Python Tkinter Video Tutorials
    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 All rights reserved worldwide Privacy Policy Disclaimer