This was my solution

image

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."
    else:
      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.

3 Likes