name_list = [\"jack\", \"anna\", \"jasmin\", \"james\", \"eric\", \"ella\", \"ri
ID: 3624757 • Letter: N
Question
name_list = ["jack", "anna", "jasmin", "james", "eric", "ella", "richard", "william", "frank", "olive"]midterm1_list = [35, 72, 20, 10, 100, 100, 50, 0, 0, 60]
midterm2_list = [75, 46, 10, 20, 30, 30, 60, 100, 80, 90]
final_list = [10, 50, 40, 70, 100, 100, 0, 60, 60, 100]
Calculate every student’s term grade by using the following weights :
%30 for midterm 1, %30 for midterm 2 and %40 for final exam.
After calculating the term grades, sort the students in descending order in respect to their term grades, and list them. When listing, print both their names and term grades.
DO NOT use any sorting function python already supplies. Write your own sorting code.
Explanation / Answer
name_list = ["ali", "ahmet", "ayse", "fatma", "engin", "isa", "mehmet", "hasan", "sinem", "dodo"] midterm1_list = [35, 72, 20, 10, 100, 100, 50, 0, 0, 60] midterm2_list = [75, 46, 10, 20, 30, 30, 60, 100, 80, 90] final_list = [10, 50, 40, 70, 100, 100, 0, 60, 60, 100] average=[0]*10 i=0 while len(midterm1_list)>i: average1=(midterm1_list[i]*30/100)+(midterm2_list[i]*30/100)+(final_list[i]*40/100) average[i]=average1 average1=name_list[i] i=i+1 if i==10: print(average) print(name_list)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.