- 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
4 Respuestas
+ 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))
+ 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))
+ 1
Average = sum of all observations/total no. of observations
0
Thanks
But I'm referring to like putting it in code form