Why doesn't this code pass?

Can someone tell me why this is returning as " Expected graduation_reqs() with gpa = 0.0 and credits = 0 to return “You do not meet either requirement to graduate!”?

statement_one = False

statement_two = True

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

1 Like

Study your logic. It is testing for one condition and returning. Failing that it is testing the other condition and returning. Failing that it cannot possibly pass the last condition. Bring that conditional to above the other two.

``````a < m and b < n
``````

then

``````a < m

b < n``````

This does not make sense to me.
a has nothing to do with b or n
and
m has nothing to do with b or n
and
b has nothing to do with a or m
and
n has nothing to do with a or m

My current code is not working:

if (gpa >= 2.0) and (credits >= 120):
return “You meet the requirements to graduate!”
if not (credits>=120):
return “You do not have enough credits to graduate.”
if not (gpa >= 2.0):
if not (gpa >= 2.0) != (credits >= 120):
return “You do not meet either requirement to graduate!”

It states, " Expected graduation_reqs() with gpa = 0.0 and credits = 0 to return “You do not meet either requirement to graduate!” "

Since you have covered the main conditions already, this statement is moot. No `if` required since the final return is the default.

``````if ...:
return ...
if ...:
return ...
if ...:
return ...
return 'default'
``````

Be sure to check the instructions so your returns match the expectation of the lesson checker.

Hey, newbie here. Zero knowledge, But I got this, took me an hour researching but I managed to figure it out!

The open book “how to think like a computer scientist”, chapter 5, conditionals helped me.
for whoever got stuck and doesn’t want to give up, it helped me.