score_list = [] while True: score = int(input()) if score == -1: break score_list.append(score) print(min(score_list)) print(sum(score_list) // len(score_list)) # // round off print(max(score_list))
itertools でこうか... すごい.., これが generator か..
itertools.takewhile の lambda x: x != -1 が False になると
itertools.repeat も yeild を止めるのか..
import itertools score_list = list(itertools.takewhile(lambda x: x != -1, (int(input()) for i in itertools.repeat(None)))) print(min(score_list), sum(score_list) // len(score_list), max(score_list), sep="\n")