편집 기록

편집 기록
  • 프로필 엽토군님의 편집
    날짜2020.11.12

    리스트의 합계와 평균 구하기 오류 질문


    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)
    print("평균점수:",total/len(score))
    

    리스트의 합계와 평균을 구하는 것이 목적이어서 이렇게 코딩을 했는데 total이 없다고 뜹니다. 어느 부분에서 잘못된 것인지 바꿔야하는 부분이 어디인지 알고 싶습니다.

  • 프로필 알 수 없는 사용자님의 편집
    날짜2020.11.12

    리스트의 합계와 평균 구하기 오류 질문


    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) print("평균점수:",total/len(score))

    리스트의 합계와 평균을 구하는 것이 목적이어서 이렇게 코딩을 했는데 total이 없다고 뜹니다. 어느 부분에서 잘못된 것인지 바꿔야하는 부분이 어디인지 알고 싶습니다.