You are viewing a single comment's thread from:
RE: [DA series - Learn Python with Steem #06] 函式
Here's mine with nothing fancy: my_list = [1,8,3,6,2,345,-23,7]
def my_average(listin):
count, tot= 0, 0
for i in listin:
count=count+1
tot=tot+i
average = tot/count
return(average)
answer = my_average(my_list)
print(answer)
Result:
43.625