Write a python program to compute score of 20 students and display sum and the average. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Write a python program to compute score of 20 students and display sum and the average.

for x in range(0, 20): x+=1 if x==20: break else: return x+=1

22nd Jan 2022, 7:48 AM
Johnson Amadi
Johnson Amadi - avatar
4 Answers
+ 2
Considering you have a list of 20 scores. scores = [67,54,92,77,...] sum = 0 for item in scores: sum+=item print(sum) print(sum/len(scores))
22nd Jan 2022, 8:22 AM
Avinesh
Avinesh - avatar
+ 2
Johnson Amadi, taking n as number of elements (which is 20) n=int(input()) a =0 for i in range(n): a += int(input()) print('Sum: ',a) print('Average:', (a/n))
22nd Jan 2022, 8:29 AM
NEZ
NEZ - avatar
+ 1
Average = sum of all observations/total no. of observations
22nd Jan 2022, 7:51 AM
NEZ
NEZ - avatar
0
Thanks But I'm referring to like putting it in code form
22nd Jan 2022, 8:08 AM
Johnson Amadi
Johnson Amadi - avatar