I'm trying to compute weighted scores using a list. I am looping through a list of students, having user input scores. With scores, I am computing weighted scores and printing the weighted score. When I enter second student's score, the new score continues with scores from previous student. How do I fix score being added to previous student? Ive tried adjusting print statement and using range function.
Tony
Enter scores: 95
Enter scores: 95
Enter scores: 80
Enter scores: 85
Enter scores: 82
wieghted average = 84.75
Steve
Enter scores: 95
Enter scores: 95
Enter scores: 80
Enter scores: 85
Enter scores: 82
wieghted average = 169.5
students = ['Tony','Steve' ]
category = [ 'Assignment', 'Quizzes', 'Projects', 'Essays', 'Exams']
weighted = [.1, .1, .3, .25, .25]
total = 0
for i in students:
print(i)
for num in weighted:
score = float(input('Enter scores: ')) * num
total += score
total /= sum(weighted)
print("wieghted average = " + str(total))
print()This is what returns:Tony
Enter scores: 95
Enter scores: 95
Enter scores: 80
Enter scores: 85
Enter scores: 82
wieghted average = 84.75
Steve
Enter scores: 95
Enter scores: 95
Enter scores: 80
Enter scores: 85
Enter scores: 82
wieghted average = 169.5
