用python並沒有那麼難,先排序後,再把最大最小去掉。
一切都可以用內建的函數搞定。
judge_score = [] times = 0 while times != 10: score = input("Plz ente " + str(times+1) + " judge's score: " ) score = float(score) times = times + 1 judge_score.append(score) judge_score.sort judge_score = judge_score[1:-1] average = float(sum(judge_score))/int(len(judge_score)) print(average)
沒有留言:
張貼留言