TransWikia.com

How to use Cases to delete specific lists from a nested list?

Mathematica Asked by froyogirlio on September 20, 2020

To simplify things, let’s say that I have a list:

aList = {{1,2,3,4},{2,2,6,6},{6,9,8,7},{6,6,6,3}}

and I want to use Cases to get rid of the lists that have more than 2 6’s. So the output would be:

{{1,2,3,4},{6,9,8,7}}

I was only able to make this:

Cases[aList,x_/;Table[Count[aList[[i]],6]>=2,{i,1,Length[aList]}][[FromDigits[Flatten[Position[aList,x]]]]]!=True

but it seems… not simple, and it doesn’t work with longer lists. Any suggestions?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP