Data Analysis with Pyhton Course includes a wrong answer I think

Topic is NumPy operations.
Website accepts the answer in the image true and declines the first one.
It’s better if they fix it I’d say.

That’s because the first one is wrong and the second one is the correct answer :wink:

It’s not even a specific numpy-thing. There is no assignment happening to a, hence a doesn’t change. Keep in mind the question was not about the result of the operation, but about the value of a.

Apart from the fact we cannot “+” numbers and arrays in basic Python, the behavior would be identical:

a = 5
a + 5 # is 10
a == 5 # still true because no new value was assigned
2 Likes