Computers and Technology

You're helping Professor Joy to calculate the grades for his course. The way his course is organised, students take two exams and their final grade is the weighted average of the two scores, where their lowest score weights 70% and their highest score 30%.

To accomplish this, you are going to need to do the following:

(1) Build the Student named tuple with the following attributes:

name (string)
exam1 (float)
exam2 (float)
(2) Write a function create_student, which will ask the user to input a single student's name, exam 1 score, and exam 2 score. The function will then create a named tuple with this information and return it.

(3) Write a function create_class, which takes as input an integer n, calls create_student n times and returns a list with the n students created.

(4) Write a function calculate_score, which takes a single Student named tuple as input, and returns the final score, where their lowest grade is weighted 70% and their highest grade is weighted 30%.

(5) Print the value returned by calculate_score for each student created in main. Round each score to two decimal places (using round(value, 2)).

Example 1: if the input is:

1
Student 1
10
0
then the output is:

3.0
Example 2: if the input is:

2
Student 1
10
0
Student 2
7
8
then the output is:

3.0
7.3
Example 3: if the input is:

0
then the output is:

Code:

from collections import namedtuple

''' Build named tuple here '''

''' Write Functions Here '''

if __name__ == "__main__":
''' Call functions and print here '''

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 11:10, 17795
Look at the far left lane in the picture. explain what the red car is doing and what it needs to do to travel safely.
Answers: 2
image
Computers and Technology, 23.06.2019 18:30, emmaishere69
List 3 items that were on kens resume that should have been excluded
Answers: 1
image
Computers and Technology, 23.06.2019 19:30, 123iamthe1
You can apply several different worksheet themes from which tab?
Answers: 1
image
Computers and Technology, 24.06.2019 01:00, arturocarmena10
The initial tableau of a linear programming problem is given. use the simplex method to solve it. x 1 x 2 x 3 s 1 s 2 z 1 2 4 1 0 0 8 3 4 1 0 1 0 10 minus3 minus12 1 0 0 1 0 the maximum is nothing when x 1equals nothing, x 2equals nothing, x 3equals nothing, s 1equals3, and s 2equals0. (be sure to simplify to lowest terms if necessary.)
Answers: 2
Do you know the correct answer?
You're helping Professor Joy to calculate the grades for his course. The way his course is organised...

Questions in other subjects:

Konu
Mathematics, 11.11.2020 02:40
Konu
Geography, 11.11.2020 02:40