In this exercise, I’m asked to use the
not operators inside of a function. Here is a screenshot of the instructions I was given:
However, I wasn’t really sure how to include the
not operator. Here is the code that I wrote for this exercise:
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 know my code is correct because I received a little checkmark for this exercise, but the instructions did say to use the
not operator and I’m just not sure how I would have done that. I don’t think I understand the
not operator very well just yet.