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!

1 Like

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.

1 Like

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 ...
1 Like

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


Hello All. I was having trouble at first but here is what worked for the final exercise 13/13 ‘Review’ in the ‘Control Flow’ project.

Line 12 is more or less an else, but moreso, a default. We can send the return value with any checking.

def applicant_selector(gpa, ps_score, ec_score):
  if gpa >= 3.0 and ps_score >= 90:
    if ec_count < 3:
      return "This applicant should be given an in-person interview."
      return "This applicant should be accepted."
  return "This applicant should be rejected."

Extra Study

  if gpa >= 3.0 and ps_score >= 90:
    return "This applicant should be given an \
in-person interview." if ec_count < 3 else "This \
applicant should be accepted."
  return "This applicant should be rejected."

The above is not the expected solution since it uses code you may not yet have learned, namely, the ternary expression.

1 Like

The screen shot I took as mentioned was of the review section part 13 of Control Flow operators and when I attempted to use the ‘else’ or ‘elif’ it would not work no matter what I did. Until I realized it wasn’t looking for that at all so that last code I ran worked. Which was weird.

As for the second thing you posted , I have not reached that section yet but thanks in advance if I get stuck I will refer back to it.

1 Like

Until we think it through. Weird is wonderful. It makes us look back and forth through the code, through the logic, though the data streams. Love stuff like this for its nuances, 'cause where logic is concerned, both code and boolean, there are a lot of possibilitities to either exploit or curtail.

A tonne of code that I’ve written has been swept aside for onr reason or another. You will go through the same experience, though one suspects a lot quicker being in the age and culture of the day. I still cut a good rug, but cannot keep up with you young’ins.

Everything in time, and take it slow at first so you learn how to survey the surroundings. It’s like being a mountaineer. Work by establishing checkpoints and landmarks. Identify objects in the vicinity. Know the time and know where North and South are. Be able to navigate terrain that goes up and down, not just laterally.


Reading again the theory of the Review lesson, it is mentioned
elif statements can be used to build additional checks into your if statements.

In the solution at the second part of the test, I suppose no additional check takes place since the inputs gpa , ps_score are written again. So, I would it consider it as an extra, complete statement, seperate from the previous, which means that “if” has to be used and not “elif” .
If this is the case, why elif is given as the “official” solution code?
In both cases however, the results that are produced are correct when I checked them using “print” and the values 4.0,91,2 to the corresponding inputs.

Morover, If we wanted to make just additional check (i.e. use “elif”) wouldn’t it be correct to refer only to the ec_count input by writing to the second conditional statement just
elif ec_count<3? (considering that gpa>=3.0 and ps_score>=90 are still valid from the previous statement?)
I checked it and gives the expected result , but is it right?

Hi guys/girls. I successful completed the exercise and then I tried to complete it using the ‘nest’ control flow suggested in the ‘question’ session at the and of the exercise.
I rewrote the ‘applicant_selector’ function this way:

The thing is, if I use an ‘elif’ statement (line 10) and I call the function, the output is ‘None’. If I replace the ‘elif’ statement with an ‘if’ statement the ouput is correct.
Why doesn’t the function work properly if I use an ‘elif’ statement? I don’t get it.