All problems

Students Above the Honours Bar

easyPythonFiltering

You're helping the registrar's office at Fairhaven University send invitations to the honours reception. The handbook rule is blunt: a GPA strictly above the bar earns an invitation, and a GPA sitting exactly on the bar does not. The bar itself is set by the faculty each year and is not the same number twice running, so it arrives with the request rather than being written into the handbook. Somebody in the cohort is usually sitting exactly on it and will be watching for their envelope, so the rule has to be read the way it is written.

The envelopes are stuffed by hand from a printed list, so the names have to come out alphabetically. The order students sit in the table is the order they enrolled, which is no use at all to somebody working through a stack of envelopes.

students_df — one row per student. gpa is on the usual 0–4 scale.

id name major gpa
1 Nora Fischer Computer Science 3.8
2 Omar Haddad Statistics 3.4
3 Petra Novakova Computer Science 3.9
4 Quinn Walsh Mathematics 3.1
5 Ravi Shah Statistics 3.6

Input

The DataFrame above is already built for you — the student rows are not read from input. What does arrive is a single line holding this year's bar, a number on the same 0–4 scale.

Task: Print a sorted Python list of the names of every student whose gpa is strictly above the bar that arrives. A student whose gpa sits exactly on the bar is not invited.

Example: if two students qualified, the output would look like ['Ada Bloom', 'Zeno Marsh'].

Sign in to solve this problem

Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.

Sign in

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…