# Shuffled list to table counts

Hello,

I know I have done something like this before but I can’t seem to find the lesson and my mind is stumped.

I have a list of numbers 1-421, each number represents a color of a skittle (1-97=red, 98-164=orange, etc)
That has been shuffled and the first 50 numbers have been put in a new list.

What I want to do is get sublists for all the colors of skittles that are in the Sample sublist and output the totals into a table, but I cannot figure out the right graph and table CL for it.

Anything to help get me started would be greatly appreciated!

Here is the link to the activity:

For your list of 50, L, you can make get counts of each color like this:

``````R_ed=length(L[L<=97])
O_range=length(L[98<=L<=164])
etc.
``````

Basically, I’m creating new lists that only take elements under the given restriction, then get the length of that list, which would obviously be the quantity of that color.

1 Like

That’s awesome: simple and beautiful! Thank you so much!

1 Like