Week 1 anamoly c2

Cell #UNQ_C2. Can’t compile the student’s code. Error: ValueError(‘The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()’)

How to correct this error?

I had the same issue. I was using .astype(int) to convert boolean to int. Error disappeared after I removed that.

Perhaps there is a mismatch in the python/numpy versions in the notebook and in the grading software?

I would recommend anytime you see this error, find your boolean operation (if statement most likely) and then print(type(variable_in_boolean_op)). Most of the time this happened when i tried to cast an array itself to boolean, when what i intended to do was use an element in the array.
Hope this helps!