atson Elementary School contains 30 classrooms numbered 1 through 30. Each class
ID: 3738130 • Letter: A
Question
atson Elementary School contains 30 classrooms numbered 1 through 30. Each classroom can contain any number of students up to 35. Each student takes an achievement test at the end of the school year and receives a score from 0 through 100. Write a Python program that accepts data for each student in the school-classroom number and score on the achievement test. Design a program that lists the total points scored for each of the 30 classrooms. Add code to accomplish the following: Modify the Watson Elementary School program so that the average of the test scores is output for each classroom, rather than total scores for each classroom. I need this done in python please
Explanation / Answer
def total_score(l): #l is the list of lists.Each member list represent a classroom
list = []
for i in range(30):
sum = 0.0
for j in range(35):
sum = sum + l[i][j]
list.append(sum)
return list
def average(l):
list = []
for i in range(30):
sum = 0.0
for j in range(35):
sum = sum + l[i][j]
sum = sum/35.0
list.append(sum)
return list
list = []
for i in range(30):
list1 = []
for j in range(35):
a = float(input(""))
list1.append(a)
list.append(list1)
print(total_score(l))
print(average(l))
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.