Great job! We covered a ton of material in this lesson and you’ve increased the number of tools in your Python toolkit by several-fold. Let’s review what you’ve learned this lesson:
ifstatements can be used to create control flow in your code.
elsestatements can be used to execute code when the conditions of an
ifstatement are not met.
elifstatements can be used to build additional checks into your
exceptstatements can be used to build error control into your code.
Let’s put these skills to the test!
The admissions office at Calvin Coolidge’s Cool College has heard about your programming prowess and wants to get a piece of it for themselves. They’ve been inundated with applications and need a way to automate the filtering process. They collect three pieces of information for each applicant:
The admissions office has a cutoff point for each category. They want students that have a GPA of 3.0 or higher, a personal statement with a score of 90 or higher, and who participated in 3 or more extracurricular activities.
Write a function called
applicant_selector which takes three inputs,
ec_count. If the applicant meets the cutoff point for all three categories, have the function return the string:
"This applicant should be accepted."
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."
Finally, for all other cases, the function should return the string:
"This applicant should be rejected."