Error:Entropy must be 0 with array of ones,

What does this mean even I got the output correct

That’s the correct output only for the first test.
The compute_entropy_test() runs several other tests, and those are what is failing.

Look carefully at the hint code in the notebook.

I still cannot find the right answer to this test…
I have everything exactly like the “hint” and still it gives me the error message above.
Can somebody help?

{code removed by mentor}

Hello @Benjamin_Martini,

You said you are having the same error which is “Entropy must be 0 with array of ones”. When we have an array of one, the value of p1 should be 1. Your code should return a 0 when p1 is equal to 1. Is your code really doing that? Please check again.

Raymond

PS1: Your code isn’t exactly like the hint.
PS2: It is against the community guideline to share assignment code, so I am removing them.

Hi Raymond,

sorry for violating the community guidelines.

After multiple hours I just realized that I mixed up ‘or’ with ‘and’.

That made the code work.
Thank you

You are welcome Benjamin @Benjamin_Martini ! Congratulations on completing the last assignment of the second course!

Raymond