logo CodeStepByStep logo

deans_list

Language/Type: Python dict collections
Author: Allison Obourn (on 2020/07/02)

Write a function named deans_list that accepts as a parameter a dictionary of student names mapped to GPAs (A decimal number between 0.0 and 4.0 inclusive) and returns a set of all students who have GPAs of 3.5 or above. For example, if a dictionary grades contains the following:

{"Hermione": 4, "Harry": 3.4, "Ron": 3.4, "Ginny": 3.8, "Draco": 3.7}

Then the call of deans_list(grades) should return the following set:

{"Hermione", "Ginny", "Draco"}

If the passed in dictionary is empty, your function should return an empty set.

Function: Write a Python function as described, not a complete program.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.