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

python language, working with nested lists and nested loops Part I: Student Grad

ID: 3725119 • Letter: P

Question

python language, working with nested lists and nested loops

Part I: Student Grade Alert (20 points) In this part, you will write a function student-alert ()·The function simulates a simplified student grade alert system, which will evaluate a list of students' grades, and return their corresponding "alert level" (more on this later). The function takes only one argument, student s, which is a list of lists. Each sub-list contains one particular student's grades in the form of letter grade strings. Each letter grade has a corresponding integer value as shown below: Letter Grade Corresponding Value 95 85 75 1) Example list: [l'A', 'B,'A,',B'1, ['A', 'F'l, ['F,'C, D', 'A','A', ['F,'F'1

Explanation / Answer

def student_alert(students): alert=[] # iterate over rows representing each student for i in [0,int(len(students))]: sum = 0 avg = 0 # iterate over grades of current student for j in [0,len(students[i])]: if students[i][j] == 'A': sum = sum + 95 elif students[i][j] == 'B': sum = sum + 85 elif students[i][j] == 'C': sum = sum + 75 elif students[i][j] == 'D': sum = sum + 65 elif students[i][j] == 'E': sum = sum + 55 avg = sum/len(students[i]) if avg70 and avg80: alert.append('G') print(alert) sample_list = [['A'], ['B','C','E'],['A','B','D','F']] student_alert(sample_list)