Простая игра Баскетбол на Python
import random
def create_basketball_game():
teams = ["Team A", "Team B"]
score = [0, 0]
while True:
team = random.choice(teams)
points = random.randint(1, 3)
if team == "Team A":
score[0] += points
else:
score[1] += points
print(f"{team} scored {points} points!")
print(f"Score: {teams[0]} {score[0]} - {score[1]} {teams[1]}")
if score[0] >= 21 or score[1] >= 21:
break
if score[0] > score[1]:
print(f"{teams[0]} wins!")
else:
print(f"{teams[1]}...