Creating a Histogram from student data

We have created a slide for a student to see the relative frequency for each potential hand in a card game. I want to have the students click 100 times to create a general histogram, but then I would like to combine all the data onto the next to make a relative frequency histogram showing the entire classes 100 clicks.

I have not used cl, to collect student data yet. Any information would be helpful. Thank you.

Here is the slide we have created.

aggregate will collect a single numeric value from each student and combine them into a numberList. Without diving into your code too much, I’d create numberLists for each students total number of each type of hand, then use totals for each list to develop your histogram.
Generic format:

numberList(`L`): aggregate(source of number)

The problem comes into play that I am using .history() to build the students lists. The aggregate function only allows for numbers. I can’t seem to find a way around this.

Well, your history is a list of the “sums”, which are your identifiers for the hands. Correct?

So, you can determine frequencies (in the graph, not the CL) for each hand using this type of format, using your list d1. This would find the number of “No Pairs” (if I’m interpreting the value of a No Pair being 5 correctly):


You could then aggregate a_0, etc. from students, and either manually create your histogram using polygons and the list totals, or create and join lists of the hand type values.

Here’s an idea that may work. What if you keep a separate variable for each of the possible hand types. NumPairs, NumTwoPairs, etc.

At the end of 100 clicks, you have a list that has 1s, 2s, etc. that represent each hand type. Say pairs = 1, two pairs = 2, etc.

Then, count how many 1s are in the list and store that to NumPairs. Repeat for each type.

Then you would aggregate those variables separately. The total of the aggregate of NumPairs would be the overall number of pairs in the class, and so on.

Must have been riding the same brainwave :slight_smile:

LOL. On two threads it seems…

@Richard_Dean , also, I didn’t try to decipher all your CL, but I’m assuming it has something to do with choosing the cards. Maybe it is something borrowed prior to some additions to lists.

You can easily create a random set of cards without repeats by using the shuffle feature:

D_eck=[1...52] #or [0...51] to more easily use mod( ) to find values

You can also add a variable as a second parameter to “deal” new cards when it is changed.

Yes. My collegue and I found an activity, and then learned a couple weeks later that you can actually shuffle the deck. What we had was working so we kept it.

I got it to work! Thank you! Finding the count of each type of hand and then building a histogram is what did the trick! Thank you!