Objectives: Functions, Lists, lists of lists
This program and the next program work together.
Grading: 1. 10 2. 5 3. 10 (this is a B) 4. 5
Each row contains the data for one student, and it will be used to compute the final letter grade of the student. Data of one row are the following
Column 0: unique student id (a number)
Col 1: “L” for the usual letter grading (A, B, …) , ”Cr” for Credit/noCr
Col 2: major – col 3: transfer student? -Col 4 -year
Col 5: gpa – col6 project 1 grade –Col 7 project 2 grade
Col 8: exam 1 grade – col 9: exam2 grade
To build the table studGrades in the Python program, copy and paste one row at a time from the file DATA_PROJ2.txt into the table studGrades . Insert commas and “[“ and “]” where needed to make studGrades a correct list of lists (Murach top of page 179)
This table MUST be in main()
Print table studGrades, showing one row per line
PRINT both results from main()
You must use a function for this question, besides main(). The table studGrades must be a parameter of this function (not a global variable). Both results must be returned to the calling program ( main()) using a “return” statement and printed from main()
First step
newProj1grade = project1Weight*project1_grade
newProj2grade= project2Weight*project2_grade
Use : project1Weight = 2 project2Weight = 1.5 .Those are “global constants” (Murach, page 114, 115, names of the constants should be in upper-case)
All rows have the same project1Weight. All rows have the same project2Weight
Second step calculate:
projgrade = newProj1grade+ newProj2grade
Third, insert the value of projgrade at column 8 of studGrades for each row. (note: insert, not append)
You must use a new function for this question
Print the following from main(): rows for student id 1111, 4555, 9500 with columns 0, 6, 7, 8, 9, 10
First, compute firstKmod as follows:
Kmod = 1.2 for juniors who are not transfer students (col 3), Is 1.4 for juniors who are transfer from CC, is 1.5 for other juniors, is 2 for sophomores or seniors and grading type “L” (col 1), 2.5 for sophomores with grading type Cr, 1 for all other students
Then
newExam1grade = Exam1Weight*Exam1_grade
newExam2 grade= Exam2Weight*Kmod*Exam2_grade
All students have the same Exam1Weight = 3 (global constant)
All students have the same exam2Weight=5 (global constant
For each student, compute
examgrade = new Exam1grade+ new Exam2grade; append
Print the following from main(): rows for student id 1111, 4555, 9500 with columns 0, 9, 10, 11
You must use a new function for this question.