Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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!

image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Principles Of Database Systems With Internet And Java Applications

Authors: Greg Riccardi

1st Edition

020161247X, 978-0201612479

More Books

Students also viewed these Databases questions

Question

3. What should a contract of employment contain?

Answered: 1 week ago

Question

1. What does the term employment relationship mean?

Answered: 1 week ago