Basketball One-on-One
This commit is contained in:
19
basketballoneonone.py
Normal file
19
basketballoneonone.py
Normal 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")
|
||||||
Reference in New Issue
Block a user