Now modify the program to display the averages of homework, quizzes and tests for each student using a nested for loop and the len() function to calculate the average of each grade your read as you loop.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Program #3: Gradebook Report (60 pts)
• Create a Python program named Exam-3.py
• Create three dictionaries: 1loyd, alice, and tyler.
• Give each dictionary the keys "name", "homework", "quizzes", and
"tests".
Now copy this code:
lloyd = {
"name": "Lloyd",
"homework": [90.e,97.e,75.e,92.0],
"quizzes": [88.0,40.0,94.0],
"tests": [75.0,90.0]
alice = {
"name": "Alice",
"homework": [100.e, 92.0, 98.e, 100.0],
"quizzes": [82.0, 83.0, 91.0],
"tests": [89.e, 97.e]
tyler = {
"name": "Tyler",
"homework": [e.e, 87.e, 75.e, 22.e],
"quizzes": [0.0, 75.0, 78.0],
"tests": [100.0, 100.0]
Add this code to create a list to include the above dictionaries as items in the list
called Student:
students-[1loyd, alice, tyler]
Add this code to display each student's name and the values of their grades for
each category:
for student in students:
print(student["name"])
print (student["homework" ])
print (student "quizzes"])
print (student["tests"])
Transcribed Image Text:Program #3: Gradebook Report (60 pts) • Create a Python program named Exam-3.py • Create three dictionaries: 1loyd, alice, and tyler. • Give each dictionary the keys "name", "homework", "quizzes", and "tests". Now copy this code: lloyd = { "name": "Lloyd", "homework": [90.e,97.e,75.e,92.0], "quizzes": [88.0,40.0,94.0], "tests": [75.0,90.0] alice = { "name": "Alice", "homework": [100.e, 92.0, 98.e, 100.0], "quizzes": [82.0, 83.0, 91.0], "tests": [89.e, 97.e] tyler = { "name": "Tyler", "homework": [e.e, 87.e, 75.e, 22.e], "quizzes": [0.0, 75.0, 78.0], "tests": [100.0, 100.0] Add this code to create a list to include the above dictionaries as items in the list called Student: students-[1loyd, alice, tyler] Add this code to display each student's name and the values of their grades for each category: for student in students: print(student["name"]) print (student["homework" ]) print (student "quizzes"]) print (student["tests"])
Once your run the program it should display something like this:
Lloyd
[90.0, 97.0, 75.0, 92.0]
[88.0, 40.0, 94.0]
[75.0, 90.0]
Alice
[100.0, 92.0, 98.0, 100.0]
[82.0, 84.0, 92.0]
[89.0, 97.0]
Tyler
[0.0, 87.0, 75.0, 22.0]
[0.0, 75.0, 78.0]
[100.0, 100.0]
Now modify the program to display the averages of homework, quizzes and tests for
each student using a nested for loop and the len() function to calculate the average
of each grade your read as you loop.
Final outcome after modification:
Lloyd
Homework average is: 88.5
Quizzes average is: 74.0
Tests average is: 82.5
Alice
Homework average is: 97.5
Quizzes average is: 86.0
Tests average is: 93.0
Tyler
Homework average is: 46.0
Quizzes average is: 51.0
Tests average is: 100.0
Hint (for the nested loop):
hw=0
#print (student["homework"])
for h in student["homework"]:
hw+= h
print ("Homework average is:", hw/len(student["homework"]))
Transcribed Image Text:Once your run the program it should display something like this: Lloyd [90.0, 97.0, 75.0, 92.0] [88.0, 40.0, 94.0] [75.0, 90.0] Alice [100.0, 92.0, 98.0, 100.0] [82.0, 84.0, 92.0] [89.0, 97.0] Tyler [0.0, 87.0, 75.0, 22.0] [0.0, 75.0, 78.0] [100.0, 100.0] Now modify the program to display the averages of homework, quizzes and tests for each student using a nested for loop and the len() function to calculate the average of each grade your read as you loop. Final outcome after modification: Lloyd Homework average is: 88.5 Quizzes average is: 74.0 Tests average is: 82.5 Alice Homework average is: 97.5 Quizzes average is: 86.0 Tests average is: 93.0 Tyler Homework average is: 46.0 Quizzes average is: 51.0 Tests average is: 100.0 Hint (for the nested loop): hw=0 #print (student["homework"]) for h in student["homework"]: hw+= h print ("Homework average is:", hw/len(student["homework"]))
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Types of Loop
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education