Module 2 Programming Assignment Failed for using explicit comparisons

The exercise to check if the book was on_shelf and not on_hold was failed with a response to not use “is” and “not” but to use “== True” instead. This response is wrong according to the Python Style Guide (PEP 8). Use of “If == True” when comparing boolean values is redundant and should be avoided.

1 Like

Perhaps the grader or unittests expects it as ‘==’.

1 Like

Hi @gawaasdorp,

The assignments test you with the material and coding concepts that are taught within the course. Yes, there can be multiple ways to implement the same logic, but if a particular thing is not covered in the course, for instance, as you pointed out, use of “is” and “not” keywords have not been discussed when it comes to comparing equality, then it is deemed incorrect in the scope of the assignment.

Hope this clears up the confusion.

Best,
Mubsi

2 Likes