Counting the instances of an element:

The count() method returns the number of times an element appears in a list. For example, the element appears twice in the list: random_list.

    >>> random_list = [2, 9, 8, 4, 3, 2, 1, 7]
>>> random_list.count(2)
2
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.77.114