import requests
import time
def get_live_score():
response = requests.get("http://api.example.com/live-score")
if response.status_code == 200:
return response.json()
else:
return None
def display_live_score():
while True:
score = get_live_score()
if score:
print(score)
else:
print("スコアを取得できませんでした。")
time.sleep(10) # 10秒ごとにスコアを更新
display_live_score()
class Player:
def __init__(self, name, injury_status):
self.name = name
self.injury_status = injury_status
def update_injury_status(self, new_status):
self.injury_status = new_status
def get_injury_status(self):
return self.injury_status
players = [
Player("Player 1", "Fit"),
Player("Player 2", "Injured"),
Player("Player 3", "Fit"),
# ...他のプレーヤーの情報
]
def monitor_players():
for player in players:
if player.get_injury_status() == "Injured":
print(f"{player.name}は怪我をしています。")
else:
print(f"{player.name}は健康です。")
monitor_players()