Let’s say this university has two classes, with sizes 10 and 50. Each student can only go to one class and all the classes are full.
The school advertises the average class size to be (10+50)/2 =30. However, you don’t believe this and then you randomly selected 6 students from the school, asked them one question: “How big is your class?” One student said 10 and the remaining five said 50. You may then calculate the average class size to be (10+50*5)/6 = 43.33. Apparently, this is larger than what the school advertises but which one is correct?
The python simulation is as follows: we have ten classes with sizes ranging from 5 to 100, randomly. The average class size is 56.9. Instead of talking to random students, we gather everyone and ask their class sizes. We collecte everyone’s response and calculate the average to be 67.64, which is still larger than average class size.
It turns out that, the latter is actually average experienced class size, which is different from average class size. Basically, more students experience higher class sizes in bigger classes, hence larger experienced class size. This is known as the class size paradox.