Hi! Can someone please help me understand why my code is not accepted?
Screen Link:
https://app.dataquest.io/m/1027/numpy-boolean-masks-practice-problems/14/finding-perfect-grades
My Code:
def has_perfect_score(grades):
return np.any(x == 100)
What I expected to happen:
To work the same way as the solution code
What actually happened:
I got the correct output for the test cases, but got the message: “Function has_perfect_score
did not return the expected value.”
I think it’s failing because you aren’t using the parametre grades
any where inside your function definition. What happens if you replace x
with grades
?
EDIT_1:
The reason it works for the test cases is because the test cases use an array called x
but I’m guessing some of the test cases for answer-checking purposes do not use x
as a variable.
1 Like
You’re right! I needed to use x for most of the previous exercises, so I didn’t even notice. Such a stupid mistake. Thanks for your help!
1 Like
Absolutely no worries, I promise it happens to all of us! Glad I could help.
1 Like