0

I have a list

l={{0, 0, 0, 3}, {0, 0, 0, 3}, {0, 0, 1, 2}}

And I would like to obtain the number of zeros in each sublist:

NZ=Table[Count[l[[i]], 0], {i, Length[l]}]

which will return the list: {3,3,2} .

Is there a way to use Map to accomplish this more cleanly?

What I would like to do is write something like: Map[Count, l] which will of course fail because Count needs a pattern to count.

Leonid Shifrin
  • 114,335
  • 15
  • 329
  • 420
JEP
  • 1,336
  • 1
  • 9
  • 20

0 Answers0