0

Suppose that I have a list like this :

test=[[1, 0, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1], [1, 0, 0, 0], [0, 0, 0, 1],
    [0, 0, 1, 0], [1, 0, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 0, 1],
    [0, 0, 0, 1], [1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1],
    [1, 0, 0, 0], [1, 0, 0, 0],[0,0,0,0]]

How can I count the number of occurrences of say the list [1, 0, 0, 0]?

Aran-Fey
  • 39,665
  • 11
  • 104
  • 149

1 Answers1

4

Use list.count:

test.count([1,0,0,0])
miindlek
  • 3,523
  • 14
  • 25