Programming Question 2: Suppose that the list of students in a university is saved as a Python dictionary, where the keys are the names of the students, and the values are tuples of length 2. The first element of each tuple is the graduation year of the student, and the second element of each tuple is the list of grades of the student. For example, if there are four students named Alice (graduating in 2023), Bob (graduating in 2024), Morgan (graduating in 2024), and Tim (graduating in 2023), then the dictionary representing these students is recorded as follows. Note that different students can have various number of grades because they have taken different number of courses per semester. student_list = {'Alice': (2023, [3.5, 2.9, 3.1, 3.8]), 'Bob': (2024, [3.0, 2.6]), Morgan': (2024, [2.8, 3.9, 3.7]), 'Tim': (2023, [2.5]} Write a Python function, called process_students, that accepts the dictionary containing the student information as its input and returns another dictionary, called updated student_list, that has the graduation year as its keys. Each value for the output dictionary is a list of length-2 tuples, each tuple representing one of the students graduating in that year. The first element of each tuple is the name of the student, and the second element of each tuple is the GPA of the student. For example, if the input to the function is the above list of students, the following dictionary will be returned as output: updated student_list = ('Tim', 2.5)], (2023: [('Alice', 3.325), 2024: [('Bob', 2.8), ('Morgan', 3.47)]}

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

python programming

Programming Question 2: Suppose that the list of students in a university is saved as a
Python
dictionary, where the keys are the names of the students, and the values are tuples
of length 2. The first element of each tuple is the graduation year of the student, and the
second element of each tuple is the list of grades of the student. For example, if there are
four students named Alice (graduating in 2023), Bob (graduating in 2024), Morgan
(graduating in 2024), and Tim (graduating in 2023), then the dictionary representing these
students is recorded as follows. Note that different students can have various number of
grades because they have taken different number of courses per semester.
student_list = {'Alice': (2023, [3.5, 2.9, 3.1, 3.8]), 'Bob': (2024, [3.0,
2.6]), Morgan': (2024, [2.8, 3.9, 3.7]), 'Tim': (2023, [2.5]}
Write a Python function, called process_students, that accepts the dictionary
containing the student information as its input and returns another dictionary, called
updated student_list, that has the graduation year as its keys. Each value for the
output dictionary is a list of length-2 tuples, each tuple representing one of the students
graduating in that year. The first element of each tuple is the name of the student, and
the second element of each tuple is the GPA of the student.
For example, if the input to the function is the above list of students, the following
dictionary will be returned as output:
updated student_list
(2023: [('Alice',
3.325), ('Tim', 2.5)],
2024: [('Bob', 2.8), ('Morgan', 3.47)]}
Transcribed Image Text:Programming Question 2: Suppose that the list of students in a university is saved as a Python dictionary, where the keys are the names of the students, and the values are tuples of length 2. The first element of each tuple is the graduation year of the student, and the second element of each tuple is the list of grades of the student. For example, if there are four students named Alice (graduating in 2023), Bob (graduating in 2024), Morgan (graduating in 2024), and Tim (graduating in 2023), then the dictionary representing these students is recorded as follows. Note that different students can have various number of grades because they have taken different number of courses per semester. student_list = {'Alice': (2023, [3.5, 2.9, 3.1, 3.8]), 'Bob': (2024, [3.0, 2.6]), Morgan': (2024, [2.8, 3.9, 3.7]), 'Tim': (2023, [2.5]} Write a Python function, called process_students, that accepts the dictionary containing the student information as its input and returns another dictionary, called updated student_list, that has the graduation year as its keys. Each value for the output dictionary is a list of length-2 tuples, each tuple representing one of the students graduating in that year. The first element of each tuple is the name of the student, and the second element of each tuple is the GPA of the student. For example, if the input to the function is the above list of students, the following dictionary will be returned as output: updated student_list (2023: [('Alice', 3.325), ('Tim', 2.5)], 2024: [('Bob', 2.8), ('Morgan', 3.47)]}
Expert Solution
steps

Step by step

Solved in 5 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY