Message Boards Message Boards

0
|
3048 Views
|
1 Reply
|
2 Total Likes
View groups...
Share
Share this post:

Counting zero in lists

Posted 4 years ago

Dear all,

I have 100 lists like the below: list1={....} list2={....} .... list100={....}

For counting zero values for a list I used "Count[list1, x_ /; x <= 0]. How do I use this command for the 100 lists?

POSTED BY: Alex Teymouri
Posted 4 years ago

Here is one way

list1 = RandomInteger[{0, 3}, 10];
list2 = RandomInteger[{0, 3}, 10];
list3 = RandomInteger[{0, 3}, 10];

Count[Symbol["list" <> ToString@#], x_ /; x == 0] & /@ Range[3]
POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract