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!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started