FAQ: Control Flow - Boolean Operators: or


This community-built FAQ covers the “Boolean Operators: or” exercise from the lesson “Control Flow”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Computer Science
Data Science

FAQs on the exercise Boolean Operators: or

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

7 posts were split to a new topic: Code displayed on lesson

When given a visual example to evaluate, we are expected to do it in our head, using what we understand about operator precedence and order of operations, and about OR. We are NOT to use the interface to solve those two expressions.

Look, and evaluate, then write only the outcome as you have determined it. If you get it wrong, then find out why.

It is imperative that we get this concept straight in our thinking, and the only way to do that is to think, not tap keys.

Which makes no sense whatever. The lesson is clearly about OR and does not reference type in any way, nor does it even mention bool.

1 Like

Personally, @mtf I see what you are trying to communicate, however, being able to distinguish the difference between true/false/or in our heads with elementary math is a paltry exercise. We are here to practice coding, not play algebra games in our head. It would be beneficial if these first check boxes also required us to manipulate the code/print results rather than a simple copy/pasting experience.


4 posts were split to a new topic: Returns true but fails?

2 posts were split to a new topic: Why do you need parentheses?

4 posts were split to a new topic: Why they are expecting "to return “True” or “True”?

Hello in the 2nd part of the exercise we have to define statement_one and statement_two as True.

How statement_one and statement_two is linked to gpa or credits? Is it predefined somewhere?
Shouldn’t it be like this below?:

gpa = True

credits = True

def graduation_mailer(gpa, credits):
if (gpa >= 2.0) or (credits >= 120):
return True

gpa and credits are the parameters of the function. (Maybe think of them as empty placeholders). When you call the function, you pass through arguments that will execute the function and return either True or False depending on whether or not one of those conditions (gpa is >= 2.0 or credits >= 120) is met.

1 Like

Thank You. That clears it up for me.
Have a wonderful day1!!

1 Like

if credits >= 120 or gpa >= 2.0:
print(“You have met at least one of the requirements.”)

gpa has to be a float value (2.0) not an Integer (2) to get the lesson to complete. for anyone else who got stuck like me