4ͷೖ͕ߦΘΕΔ""" sum = 0 for i in mylist: sum += i # a += 1 a = a + 1Λҙຯ͢Δ return sum / size score = [70, 82, 88, 90] average = get_average(score, 4) print("average:{}".format(average))
+= 1 ... print(a) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<stdin>", line 2, in hoge UnboundLocalError: local variable 'a' referenced before assignment