def check_same_total(algosia_scores, bajtek_scores): algosia_scores.sort(reverse = True) bajtek_scores.sort(reverse = True) for idx, algosia_score in enumerate(algosia_scores): if bajtek_scores[idx] > algosia_score: print("Bajtek") return elif algosia_score > bajtek_scores[idx]: print("Algosia") return print("remis") if __name__ == "__main__": algosia_in = input() algosia_scores = [int(score) for score in algosia_in.split()] algosia_total = sum(algosia_scores) bajtek_in = input() bajtek_scores = [int(score) for score in bajtek_in.split()] bajtek_total = sum(bajtek_scores) if bajtek_total > algosia_total: print("Bajtek") elif algosia_total > bajtek_total: print("Algosia") else: check_same_total(algosia_scores, bajtek_scores)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | def check_same_total(algosia_scores, bajtek_scores): algosia_scores.sort(reverse = True) bajtek_scores.sort(reverse = True) for idx, algosia_score in enumerate(algosia_scores): if bajtek_scores[idx] > algosia_score: print("Bajtek") return elif algosia_score > bajtek_scores[idx]: print("Algosia") return print("remis") if __name__ == "__main__": algosia_in = input() algosia_scores = [int(score) for score in algosia_in.split()] algosia_total = sum(algosia_scores) bajtek_in = input() bajtek_scores = [int(score) for score in bajtek_in.split()] bajtek_total = sum(bajtek_scores) if bajtek_total > algosia_total: print("Bajtek") elif algosia_total > bajtek_total: print("Algosia") else: check_same_total(algosia_scores, bajtek_scores) |