I'm asking for help because I have difficulty understanding the problem (list.append)

Asked 2 years ago, Updated 2 years ago, 118 views

scores =[]
sum_scores = 0

for i in range(5):
   value = int (input ("Enter your grade")
   scores.append(value)
   sum_scores = scores

scoresAvg = sum(sum_scores) / 5

print(sum(scores))
print(scoreAvg)

I don't know why there's an error

append list python

2022-09-21 10:41

1 Answers

scores =[]
sum_scores = 0

for i in range(5):
   #value = int (input ("Enter your grade")
   value = int (input ("Enter your grade")
   scores.append(value)
   sum_scores = scores

scoresAvg = sum(sum_scores) / 5

print(sum(scores))
#print(scoreAvg)
print(scoresAvg)

Only the 'simply' error (not executed) is described above.


2022-09-21 10:41

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.