Trusted by Students Everywhere
Why Choose Us?
0% AI Guarantee

Human-written only.

24/7 Support

Anytime, anywhere.

Plagiarism Free

100% Original.

Expert Tutors

Masters & PhDs.

100% Confidential

Your privacy matters.

On-Time Delivery

Never miss a deadline.

You have a list of strings which contain student record

Computer Science Nov 06, 2020

You have a list of strings which contain student record. Each string contains the student's name, and their grades in Maths, Physics and Chemistry. The grades can be floating values. These values (names and grades) are separated by comma. You are required to save the record in a dictionary data type. The user then enters a student's name. Output the average percentage marks obtained by that student, correct to two decimal places. Example: input : grades = ["Jake, 99, 70, 50", "Dennis, 100, 100, 98"] name = "Dennis" output: "The average grade of Dennis is 99.33" In [58]: grades = ["Jake ,99 , 70, 55", "Dennis, 100, 100, 98"] det_grades = {} student_list = [i. strip("") . split(", ") for i in grades] for student in student_list: names = student[0] total = int(student[1] ) + int(student[2]) + int(student[3]) avg_grade = total/3 dct_grades [ names ] = round (average, 2) name = 'Jake' print ( 'The average grade of '+name+ ' is', dot_grades [name]) IndexError Traceback (most recent call last) <ipython- input-58-668cb700ed31> in <module> 7 for student in student_list: 8 names = student[0] - --->9 total = int(student[1]) + int(student[2]) + int(student[3]) 10 avg_grade = total/3 11 dct_grades [ names ] = round (average, 2) IndexError: list index out of range

Expert Solution

For detailed step-by-step solution, place custom order now.
Need this Answer?

This solution is not in the archive yet. Hire an expert to solve it for you.

Get a Quote
Secure Payment