Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hello. Here is my code: def avg_GPAwork(work_choice): work = [] work = list((Stu

ID: 3547611 • Letter: H

Question

Hello.


Here is my code:


def avg_GPAwork(work_choice):
    
        work = []
        work = list((Student_IDs.values()))
        print(work)

        for hours in range(len(work)):
            student_hours = work([hours][6])
            print(student_hours)


Here is what work is:


[['Childs, Julia', '9939456', '12/12/1993', 'Computer Science', '3.89', '8'], ['Gaga, Lady', '7733469', '10/10/1980', 'Computer Science', '1.20', '40'], ['Joe, Billy', '80978632', '01/10/1992', 'Undeclared', '2.4', '25'], ['Armstrong, Lance', '0034728', '07/21/1993', 'Computer Science', '3.47', '10'], ['Cronkite, Walter', '4357349', '10/02/1992', 'Math', '3.21', '0'], ['Williams, Serena', '8453392', '02/14/1994', 'Math', '3.09', '5'], ['Harmond, Josh', '30145692', '12/03/1994', 'Biology', '3.9', '0'], ['Pawlakos, Eric', '1234567', '05/23/1993', 'Statistics', '3.8', '8']]



I continue to get an indexing out of range error. What am I doing wrong/how can i fix it?

Explanation / Answer

Change
student_hours = work([hours][6])
to the following

student_hours = work([hours][5])