Challenge: Students Performance Tracking System
Get an overview of the student's performance tracking system and implement it using the Iterator pattern.
We'll cover the following
Problem statement
In the bustling world of education, keeping track of student performance is crucial for educators and administrators alike. Your task is to create a student performance tracker using Python that utilizes various advanced concepts such as iterators, comprehensions, sets, dictionaries, and generators. By implementing this solution, you will gain a deeper understanding of these powerful Python features while solving a practical problem.
You’ll be given a list of dictionaries, where each dictionary includes keys such as name
, age
, subjects
, and grades
. The subjects
key maps to a set of subjects the student is enrolled in, and the grades
key maps to a dictionary containing subject-grade pairs.
Tasks
Here are the tasks required to complete this programming challenge:
Calculating averages
- Write a function that takes the list of student dictionaries as input and returns an iterator that yields tuples of student names and their average grades.
- Use a generator expression to calculate the average grade for each student and yield the result.
- Ensure that the function handles cases where a student might not have any grades yet.
Filtering students
- Implement a generator function that takes the list of student dictionaries and a minimum average grade as inputs.
- This generator should yield the names of students who have an average grade above the given threshold.
- Utilize comprehension to filter students based on the minimum average grade requirement.
Note: You may practice writing your code in the playground below before moving to its solution lesson.
Get hands-on with 1400+ tech skills courses.