Why should I use NOT?

So the code I wrote at first, because my thought when reading the exercise was “I don’t see why not is essential here when I can just use normal operators to describe everything” was:

def graduation_reqs(gpa, credits):
if (gpa >= 2.0) and (credits >= 120):
return “You meet the requirements to graduate!”
if (gpa >= 2.0) and (credits < 120):
return “You do not have enough credits to graduate.”
if (gpa <2.0) and (credits >= 120):
return “Your GPA is not high enough to graduate.”
if (gpa <2.0) and (credits < 120):
return “You do not meet either requirement to graduate!”

I was told that this solution is wrong, but is that because I didn’t use ‘not,’ or because the code would genuinely not work?

I guess my overall question is, after this lesson and exercise, I don’t understand why I would use ‘not.’


It is so much easier to read and evaluate Python code if it is properly posted as Python, a language to which indentations are integral. Thus posted, it is easy to follow, and can be copied and pasted for testing.

To do so, just use the </> icon that is in the middle of the menu bar that appears at the top of the text box you are typing in.

If you do so, could you also include a copy of the error message rejecting your code?

Since we’ve already determined there is only one path to graduate, why have two more checks? It’s only rubbing salt into the wound. If however the wish is to inform of what tripped them up, then it could be presented in a reverse fashion…

if gpa < 2:
    return "does not meet GPA requirement"
elif credits < 120:
    return "does not meet credit requirement"
    return “You meet the requirements to graduate!”

I did exactly the same thing and have exactly the same question. I got the right answer and the corresponding green check mark (presumably because my indentation was correct?), but I still can’t imagine a situation in which I’d need to use “not” and these relational operators for greater than and less than.

1 Like

NOT is an operator that often takes us into a different plane of thought. Still, early logic found a place for it. Time to give that some allowance?

I found your question interesting! Particularly since I don’t know the answer.

So I looked into this link which has an interesting discussion into the matter:

Of particular note, it’s interesting how the use applies to different contexts revolving None (which I find to be a useful thing to know about since None is quite common).