Question: In this challenge, we are supposed to take the array of numbers stored in arr and return 1 if the mode equals the mean ,

In this challenge, we are supposed to take the array of numbers stored in arr and return 1 if the mode equals the mean, 0 if they don't equal each other (ie. [5, 3, 3, 3, 1] should return 1 because the mode (3) equals the mean (3)). The array will not be empty, will only contain positive integers, and will not contain more than one mode.

I could not get NumPy to work with this challenge, but I am only 2 months into coding so maybe I misunderstood the use of that tool but what is below is what I coded. I can get mean and the mode separately, but when I try a while loop, a for loop, or if... I cannot get the return I am looking for.

I am not looking for a rewrite for the answer, LOL, just how to fix the current mess I have on the screen. But if you really think I would benefit from knowing your way, please do share that as well!

In this challenge, we are supposed to take the array of numbers

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!