FAQ: Control Flow - Relational Operators II


This community-built FAQ covers the “Relational Operators II” 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 Relational Operators II

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!


why can’t I run the code if the (if) condition is satisfied? It only runs when you add a print statement while calling the function. Why is it happening ? [exercise of relational operataors II ][https://www.codecademy.com/paths/computer-science/tracks/cspath-flow-data-iteration/modules/dspath-control-flow/lessons/control-flow/exercises/relational-operators-ii]


We need to see your code to be able to answer this question. Please post it in a reply. Thank you for posting the URL of the exercise. That makes things so much easier now that we know where to test what you have.


sir, here is the code of that particular thing.

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!”



There is no output from the above code. The value is returned to the caller and everything ends there. To see the return value we must print it, or at least assign it to a variable so it can be retrieved and printed later.


Then why is it not printing this :-
def applicant_selector(gpa, ps_score, ec_count):
if gpa >= 3.0 and ps_score >= 90 and ec_count >= 3:
return “This applicant should be accepted.”
elif gpa >= 3.0 and ps_score >= 90 and ec_count < 3:
return “This applicant should be given an in-person interview.”
return “This applicant should be rejected.”
a = applicant_selector(4.0,92,3)


That’s not the same code.


This code is for the following problem on the website


This is off-topic. Can we solve the original, on topic problem and step away?


Yes sir we can solve the original one . I will try to grasp it from there itself.


If you have a problem still with that other lesson, stay engaged here. We will see that it gets archived in the appropriate section, while we work out a solution with you.