YouTip LogoYouTip

Python3 Att List Count

# Python3.x Python3 List count() Method [![Image 1: Python3 Lists](#) Python3 Lists](#) * * * ## Description The count() method is used to count the number of times an element appears in a list. ## Syntax The syntax for the count() method is: list.count(obj) ## Parameters * obj -- The object to be counted in the list. ## Return Value Returns the number of times the element appears in the list. ## Example The following example demonstrates the usage of the count() function: ## Example #!/usr/bin/python3 aList =[123,'Google','Tutorial','Taobao',123]; print("123 element count: ", aList.count(123)) print("Tutorial element count: ", aList.count('Tutorial')) The output of the above example is: 123 element count: 2Tutorial element count: 1 [![Image 2: Python3 Lists](#) Python3 Lists](#)
← Python3 Att List CountPython3 Att List List β†’