Write a python program that:
students = int(input('Number of students: '))
subjects = int(input('Number of subjects: '))
name = []
score = []
for i in range(students):
name.append(input('Name: '))
[score.append(int(input('Score ' + str(j+1) + ' subject: '))) for j in range(subjects)]
def sum_sub(score, num):
s = [score[i:i + num] for i in range(0, len(score), num)]
return [sum(j)/num for j in s]
names = name
scores = sum_sub(score, subjects)
total = [max(scores), names[scores.index(max(scores))]]
print('Best final score and student: {0}, {1}'.format(total[0], total[1]))
Comments
Leave a comment