Basketball One-on-One

This commit is contained in:
2023-10-17 20:59:27 +02:00
parent 49a86bff16
commit 26347645b6

19
basketballoneonone.py Normal file
View File

@@ -0,0 +1,19 @@
def end_game(winner):
print(winner)
exit()
game_records = input()
a_score = 0
b_score = 0
for i in range(0, len(game_records), 2):
if game_records[i] == "A":
a_score += int(game_records[i + 1])
else:
b_score += int(game_records[i + 1])
if a_score >= 11 and (b_score < 10 or a_score - b_score >= 2):
end_game("A")
if b_score >= 11 and (a_score < 10 or b_score - a_score >= 2):
end_game("B")