Control Flow Review

https://www.codecademy.com/courses/learn-python-3/lessons/control-flow/exercises/review

1 Like

2.

Great! The admissions office also wants to give students who have a high GPA and a strong personal statement a chance even if they don’t participate in enough extracurricular activities.

If an applicant meets the cutoff point for GPA and personal statement score, but not the extracurricular activity count, the function should return the string:

“This applicant should be given an in-person interview.”

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 <= 2:
    return "This applicant should be given an in-person interview"
  

Trying to see my mistake without looking at the solution.

This is stated at the bottom of the screen

Expected the test values GPA = 3.0, Personal Statement Score = 90, and Extracurricular count = 2 to return the response This applicant should be given an in-person interview., instead it return the response This applicant should be given an in-person interview.

Not understanding my fault here.

1 Like

Thank you period… Mtf you stated it can be pedantic, yes it can.

3 Likes

Sentences do end with a full stop, generally. Such minor errors are always going to happen, to anyone. Keep grammar and spelling in mind when doing lessons. It often has a bearing.


Here’s a thought for when you come back to rehash this…

What if we cache the boolean expressions and then do the logic?

a = ...
b = ...
c = ...
if a and b and c:
    return ...
elif a and b and not c:
    return ...
else:
    return ...

Don’t stop now to contemplate this. Catch it on the next review of this exercise/module.

2 Likes