 And so I've laid out a few steps here. So our first step is to calculate the sample statistic. And in particular, our chi-squared statistic is the sum of this fraction. We've got our observed counts minus our expected counts squared divided by the expected counts and then all summed together. And so in order to calculate this chi-square sample, first we need to get our observed counts and our expected counts. Our observed counts are what we see here. So we need to calculate the expected counts and then we need to do this summation. And so the first thing that we'll do is determine the sample size. So I'm gonna take this table variable up here. I'm gonna do the count column. So table.count and this is referring to the column count. And then I'm going to sum that. So essentially by summing all of our counts, we can actually get our sample size. And then I can print that so that we can see what it looks like. 21 cards drawn. Next we need to get the expected counts. And so I'm gonna create a new array using this numpy.array command, which is essentially just all of my expected proportions. Now this is what we wrote up here in our null hypothesis 0.25 and it's the same for each category. And so that is my expected probability, my proportion. And so then my count exp is just my sample size times my proportions. We can print that at the end. And so we can see that it's all the same because they all have the same proportion, but the chi-square test compares counts to each other. So we need to somehow take that proportion into account and that's what we're doing here. So in theory, we would have 5.25 cards of each suit. Now that isn't actually possible, but that is sort of the ideal count based off of our sample size 21. And so then the next step is to actually calculate the chi-square statistic. So I'm gonna call this chi-square underscore stamp because it's my sample statistic. I'm gonna do two sets of parentheses. And in the first parentheses, I'm gonna take my observed count. So this is following this function up here. So my observed count minus my expected count squared. So in Python, when we want to do an exponential, we do two asterisks. And then I divide that by my count exp. And then outside of all the parentheses, I sum it. So we can run that. And now I have my sample chi-square value as 1.66. And so this is the first step to developing our randomization procedure. The next step is actually implementing that randomization. So once again, we're gonna be using this NP random choice which we're quite familiar with at this time. And in particular, we're going to replace equals true. And so the first step within step two is to initialize the variables. So we need to tell it how many iterations we wanna do. And I'm going to set up an empty array. And then we can start the procedure. So we can say for i in range of n, similar to what we've done before. And then I'm going to create a new variable that I call sim suits. And this is what's going to randomly draw a suit from our options. So we can say np.random choice. And I'm just gonna draw from table suit. And if we scroll back up here, we can see that the suit column in our table data frame is diamonds, hearts, clubs, or spades. So it's just gonna draw one of those categories similar to drawing a card. Then slightly different from what we've done before, we need to define the probability at which to draw those suits 25% each. We define how many we wanna draw our sample size, lowercase n, and we replace equals true so that we don't run out of suits. So this will be our simulated draws, but we need to make sure those get into counts, which is what the chi-square test compares. And so we can say sim underscore counts. And so in square brackets, I'm gonna say sum or sim suits equals, equals diamonds. And then comma, our next point in the array is the sum of where sim suits equals, equals hearts. And I missed a parenthesis right there. So each of these summations needs its own parenthesis so that we can read it. I'm gonna enter down in between because it's still wrapped in the square brackets. Python knows it's still part of the same command. So then I do sim suits equals, equals, clubs. And then finally, the sum of sim suits that equals spades. And so this will be my simulated count variable. And then last but not least, we need to use that simulated count variable to calculate our sample, sampling distribution, our randomization chi-squared. So this is where our empty chi-square array comes in, set the ith term equal to sim suits or sim counts, minus count exp, which is what we defined up here, squared divided by count exp and then summed together. So we can run this and then we can see what the chi-square looks like, just an array, a very long array. So I won't keep that there, but good to know that it worked. And so then the next step is actually calculating our p-value.