FAQ: Control Flow - Review


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

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!


Hey everyone, I’m just struggling to figure out why my solution to this exercise isn’t working. My solution was this:


In the given solution, the elif statement on line 12 was ‘ec_count < 3’ instead of my not statement. Other than that they were the same.

I can’t figure out why it didn’t work my way. Any help would be great!


To avoid repeating those numbers, I used three variables inside the function:

def applicant_selector (gpa, ps_score, ec_count):
gpa_ok >= 3.0
ps_score_ok >= 90
ec_count_ok >= 3
if (gpa_ok == True) and (ps_score_ok == True) and (ec_count_ok == True):
return “This applicant should be accepted.”
elif (gpa_ok == True) and (ps_score_ok == True) and (ec_count_ok == False):
return “This applicant should be given an in-person interview.”
return “This applicant should be rejected.”


Hi orafaelporto, I like your code, very innovative!

I would suggest making the following change though, otherwise it produces an error. That is because the function in its original format never actually makes a reference to the inputs (gpa, ps_score, ec_count) inside the function.

gpa_ok = gpa >= 3.0
ps_score_ok = ps_score >= 90
ec_count_ok = ec_count >= 3

I hope this helps!


Thanks for the suggestions, orafaelporto & sabeeh.khayyat! However, to clarify, is there a way to integrate “elif” and else functions? The solution provided uses this method but when I tried myself, I received errors


Are you being given a lesson error message or a console error message? From the photo it looks like the syntax is correct, so the problem must be elsewhere.


I received the following error for this assignment:

Expected the test values GPA = 0.2, Personal Statement Score = 50, and Extracurricular count = 0 to generate the response This applicant should be rejected., instead it generated the response This appliant should be rejected…

All of my solutions were excepted until the final one, the ‘else’ statement. I submitted a bug report. i had to take the solution to move beyond that lesson and the only thing that changed was my ‘elif’ statement for the im-person interviews. I chose not to include ec_count because all applicants who had met all three requirements would have already been removed with my initial ‘if’ statement.
elif gpa >= 2.0 and ps_score >= 90: # This should have worked
The solution provided included ec_count < 3 which was redundant.


Well that’s what I get fro trying to do this at 2:30 A.M.
The error message clearly shows that I can’t type or read.
appliant != applicant
raise YouMadeAFoolOfYourselfOnlineError


Been there, my friend! :smile:


Hello everyone:

I’m new of coding. The following picture is solution of 10/13:

They all use boolean operators in those pictures but sometimes the components have “()” and sometimes don’t.
Are “()” matter? or something wrong?

Sorry for the small picture because new register can only post 1 picture but I have 3.


I see. You may need to check the grammar“elif”. In my opinion,“elif” is used in the situation,“The following conditions are included in the above definition”.Thus , exchanging it will be helpful.


When return is used in each conditional branch we don’t need elif, just if on the next conditional. Likewise, no else is needed, either, just a final return.

if ____:
    return ...
if ____:
    return ...
return ...


can you send a screnshot ? I have been trying your style and its says gpa_ok not defined