Reference no: EM132212295
(Write Python Program)
This function returns a new list that includes negative numbers from a given list xs.
def negatives(xs):
result = []
for x in xs:
if x < 0: result.append(x)
return result
Write a recursive version of negatives.
(Write Python Program)
You are tasked to compute the letter grade for a course by processing the data file. Students in the course take 10 tests and the final exam. Each test is worth 10
points and the final exam 20 points. Two lowest test scores are eliminated from the course grade computation. Adding the eight highest test scores and the final exam will result in 100 points maximum. The letter grades are determined as follows:
"A" 95
"A-" 90
"B+" 87
"B" 84
"B-" 80
"C+" 77
"C" 74
"C-" 70
"D+" 67
"D" 64
"D-" 60
The content of a text file has this format
Student ID,Student Name,Final [20],Quiz 1 [10],Quiz 10 [10],Quiz 2 [10],Quiz 3 [10],Quiz 4 [10],Quiz 5 [10],Quiz 6 [10],Quiz 7 [10],Quiz 8 [10],Quiz 9 [10],Course Grade
jabbott,"Abbott, John",17.8,10,10,9.15,9.5,7.8,6.8,7.7,9.9,9.5,5,85.35
jbenson,"Benson, Jim",18.4,9,5,7.1,8.5,9.1,10,8,9.3,5.5,6,77.5
bsimpson,"Simpson, Benny",15.8,,7,8.65,,6.5,9,7.5,7,5,5.5,60.15
btalbott,"Talbott, Bruce",20.8,8.8,10,10,10,9.8,10,10,9.9,10,8.5,97
The first line is the header, describing the file content. Notice that the first line is displayed here on three lines because the line is too long to be displayed as a single line here. The course grades, like 85.35 and 77.5 are values computed by the Sakai system, which is irrelevant to how the actual course grade is evaluated.
When a student misses a test, no value is provided. If you look at the data for bsimpson, you will notice that he is missing two tests (Test 1 and Test 4). For missing scores, you use 0.Create an output file letter_grades.txt with the student id and his/her letter grade.