What am I missing in my code?

I am stuck on step 2. I complete step 1 by making statement_one and statement_two equal to the provided expressions. When I try to do step 2, though, my function is exactly the same as the solution, but it won’t give me the appropriate return until I change the statement_one and statement_two to equal False and True. Can anyone explain what those two statements have to do with the step 2 function?

If you are doing this,

statement_one = (2 + 2 + 2 >= 6) and (-1 * -1 < 0)

statement_two = (4 * 2 <= 8) and (7 - 1 == 6)

Then Reset and start over. That is not what we are expected to do. This is a thought process exercise.

In our heads we should be able to examine each operand and evaluate…

(2 + 2 + 2 >= 6)  =>  True, or False?  T  |
=>                                    and |  False
(-1 * -1 < 0)     =>  True, or False?  F  |

(4 * 2 <= 8)      =>  True, or False?  T  |
=>                                    and |  True
(7 - 1 == 6)      =>  True, or False?  T  |

Thank you, I get that portion now, but for step two, even when I set statement_one = False and statement _two = True, I still get the same error. I literally copy and pasted the solution, which was exactly the same as what I had written and when I copy and pasted the solution it worked, but with what I had written it didn’t. Is there something I’m missing.

Is this the code?

def graduation_reqs(gpa, credits):
  if gpa >= 2.0 and credits >= 120:
    return "You meet the requirements to graduate!"
2 Likes

Yes. When I type that in it marks the step with an X and I get the statement "Expected graduation_reqs() with test values gpa = 2.0 and credits = 120 to return “You meet the requirements to graduate!”

I copy and paste it from the solution, it’s marked with a check even though they both say exactly the same thing.

This is what I typed:
def graduation_reqs(gpa, credits):
if (gpa >= 2.0) and (credits >= 120):
return “You have enough credits to graduate!”

This is the provided solution:
def graduation_reqs(gpa, credits):
if (gpa >= 2.0) and (credits >= 120):
return “You meet the requirements to graduate!”

Hah nevermind, I see what I missed. The return statement. Well I feel like a dummy now. Thank you for helping!

1 Like

You’re welcome! Lesson here? Read and follow instructions closely.

Since we are not grouping operations, no parens are needed.

if gpa >= 2.0 and credits >= 120

The relationship operators have precedence over AND, so those operations are carried out first.