Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Python List count()

# list of cars
cars = ['Benz',('volkswagen','BMW'),'Ford','Ferrari',('volkswagen','BMW')]
numbers= [1,(1,3),5,7,(1,3),3,1,6,(1,3)]

# BWM Count in list
bmwCount = cars.count(('volkswagen','BMW'))
print("total no BMW, volkswagen count is = ",bmwCount)

# number count in list
numCount = numbers.count((1,3))
print("The count of number 1,3  is = ",numCount)
Source by itsmycode.com #
 
PREVIOUS NEXT
Tagged: #Python #List
ADD COMMENT
Topic
Name
1+6 =