Question
ID Name Surname LAB1 LAB2 LAB3 LAB4 LAB5 LAB6 LAB7 LAB8 LAB9 LAB10 midtrm Finla 20163501001 Hande Uymaz 85 100 95 85 100 95 90
ID Name Surname LAB1 LAB2 LAB3 LAB4 LAB5 LAB6 LAB7 LAB8 LAB9 LAB10 midtrm Finla 20163501001 Hande Uymaz 85 100 95 85 100 95 90 95 100 90 85 100 20153501002 Serhat Uzunbayir 75 95 80 90 100 65 90 100 85 90 55 95 20153501001 Erdem Okur 60 95 65 95 100 95 70 70 80 65 80 80 20183501001 Cinar Gedizlioglu 95 90 60 85 100 90 90 75 40 100 100 65 20153501003 Berkehan Akcay 50 65 30 55 95 40 55 60 65 20 95 20 20163501003 Levent Eren 40 95 100 85 70 100 70 75 55 95 60 90 20173501002 Cagkan Uludagli 70 55 75 0 80 90 100 100 85 75 55 70 20193510004 Tugay Direk 75 70 80 75 75 65 80 100 95 30 0 75 20173513004 Duygu Geckin 85 0 100 50 75 50 80 60 90 65 50 85 20173506001 Cemre Serbetcioglu 85 85 75 60 80 65 90 80 75 55 65 100 20183512005 Saygin Portakal 100 100 85 85 90 85 100 95 100 85 85 100 20183516015 Cagatay Kirmiziay 55 80 75 55 65 80 50 0 70 85 85 55 20193518002 Beyza Emre 95 65 75 65 80 90 85 95 60 65 50 85 20183514002 Ozge Suer 70 40 90 75 60 100 100 70 75 95 100
The first row contains headers, and the remaining rows contain the following info: ID number, name, surname, and 12 grades for each student. All of these values are separated by tab characters. Out of the 12 grades, the first 10 are lab scores, the next is the midterm exm score, and the last grade is the finla exm score. Check grades.txt to see for yourself. Here is a screenshot of how the .txt file looks (some of the lines might look misaligned depending on your system): Read this file into a dictionary. For each row of grades.txt, create a new entry in the dictionary, such that the key is the students ID, and the value is all remaining data (name, surname and all 12 grades). Therefore, the key should be an integer, and the value should be a list for each dictionary entry.
Define a function called letter_grade. This function should accept a single parameter, as an integer. The function should compute and return the letter grade which corresponds to the grade given as parameter.
Define a function called find_average. This function should accept 2 parameters: a dictionary, and an ID number. The function should check the entry which corresponds to the key ID in the dictionary, calculate the weighted average grade of that student and finally return that average grade
Average Lab Score: 30%
Midtrm Exm Score 30%
Finla Exm Score 40%
Define a function called write_averages. This function should accept 2 parameters: a dictionary, and a filename. The function should traverse all entries of the dictionary. For each entry, the function should calculate the student's letter grade, then write the necessary info (ID, name, surname, letter grade) on the file, whose name is given as the second parameter to this function.
Define a function called best_final_grade. This function should accept a single parameter as a dictionary. This function should iterate through all entries of the dictionary and find the highest final score. The function should finally print the necessary info, the highest final score and its owner (name and surname), on the console. If multiple people have the highest final score, the first of those should be printed.
Now, we return to the main script. Simply call the functions best_final_grade and write_averages with appropriate parameters. When calling write_averages, the filename parameter should have a .txt extension. Your output should consist of a console display, and an output text file.
PLEASE USE ONLY PYTHON!
Midtrm LAB1 85 75 60 95 50 LAB2 100 95 95 LAB4 85 90 95 85 55 85 LAB5 100 100 100 LAB6 95 65 95 90 40 90 65 LAB3 95 80 65 60 30 100 75 80 100 75 85 ID 20163501001 20153501002 20153501001 20183501001 20153501003 20163501003 20173501002 20193510004 20173513004 20173506001 20183512005 20183516015 20193518002 20183514002 40 Name Hande Serhat Erdem Cinar Berkehan Levent Cagkan Tugay Duygu Cemre Saygin Cagatay Beyza Ozge 100 95 70 80 95 Surname Uymaz Uzunbayir okur Gedizlioglu Akcay Eren uludagli Direk Geckin Serbetcioglu Portakal Kirmiziay Emre Suer 100 LAB8 95 100 70 75 60 75 100 100 60 80 95 70 55 LAB7 90 90 70 90 55 70 100 80 80 90 100 50 85 100 0 75 50 LAB9 100 85 80 40 65 55 85 95 90 75 100 70 60 75 LAB10 90 90 65 100 20 95 75 30 65 55 85 85 65 95 70 90 65 50 65 85 80 90 100 75 85 85 100 55 95 70 75 75 80 90 60 85 100 80 65 40 85 65 75 75 90 55 65 75 80 60 0 95 70 90-100 AA 85-89 BA 80-84 BB 75-79 CB 70-74 CC 65-69 DC 60-64 DD 50-59 FD 0-49 FF In the case of fractional numbers, you should round the grade properly to the nearest integer (i.e. a grade of 89.5 should be equivalent to AA). You can use the built-in function round" to achieve proper rounding. For example, round (89.5) returns 90; round (89.8) returns 90; round (89.49) returns 89; round (89.0) returns 89Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started