usman = { "name": "Usman", "homework": [90.0,97.0,75.0,92.0], "quizzes": [88.0,40.0,94.0], 5 "tests": [75.0,90.0] } pear

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

usman = { "name": "Usman", "homework": [90.0,97.0,75.0,92.0], "quizzes": [88.0,40.0,94.0], 5 "tests": [75.0,90.0] } pear

Post by answerhappygod »

usman = {
"name": "Usman",
"homework": [90.0,97.0,75.0,92.0], "quizzes": [88.0,40.0,94.0],
5
"tests": [75.0,90.0] }
pearl = {
"name": "Pearl",
"homework": [100.0,92.0,98.0,100.0], "quizzes": [82.0,83.0,91.0],
"tests": [89.0,97.0]
}
michael = {
"name": "Michael",
"homework": [0.0,87.0,75.0,22.0], "quizzes": [0.0,75.0,78.0],
"tests": [100.0,100.0]
}
Above is a program containing the definition for three dictionaries named usman, pearl and michael. This program is aimed towards creation a gradebook for teacher's students. You are required to do following:
a.
i. Create a list called students that contains names usman, pearl, and michael (referencing each dictionary above).
ii. For each student in your (students) list, print out that student's data, as follows:
print the student's name
print the student's homework
print the student's quizzes
print the student's tests
b.
Write a function called “average” that takes a list of numbers and returns the average as follows:
i. Define a function called average that has one argument, numbers.
ii. Inside that function, call the built-in sum() function with the numbers list
as a parameter. Store the result in a variable called total.
iii. Use float() to convert total and store the result in total.
iv. Divide total by the length of the numbers list. Use the built-in len()
function to calculate that.
v. Return that result.
c.
Write a function called get_average that takes a student dictionary (like usman, fatima, or michael) as input and returns his/her weighted average. Use the following steps:
i. Define a function called get_average that takes one argument called student.
ii. Make a variable “homework” that stores the average() of student["homework"].
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply