Get Sum and Mean of List Error Question

Asked 2 years ago, Updated 2 years ago, 16 views

def func_sum(score,total):
    total=0
    for data in score:
        total+=data
    return total

    score=[73,95,80,57,99]
    total=func_sum(score)
print("Total score:",total)
print ("average score:", total/len(score))

The purpose is to find the total and average of the list, so I coded it like this, but it says that there is no total. I want to know which part is wrong and which part needs to be changed.

python

2022-09-20 19:34

1 Answers

def func_sum(score,total): You have to erase the total from the . You made a function that takes two arguments and put in only one, so it said that there is no total.


2022-09-20 19:34

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.