I have a random set of test scores for 50 students. Each student answered 20 questions, and the maximum score for each question is 5. How can I get the total score of each student in a list by using a Python function?
results_sheet =  num_of_questions = 20 num_students = 50 #generate scores for each student and append to results_sheet for student in range(num_students): scores = random.choices(list(range(0,6)),k=num_of_questions) results_sheet.append(scores) #The result here is a list of lists.
I have tried the following code but am missing something:
total = 0 for val in results_sheet: total = total + val return total
Thank you very much.