Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Which Premier League match should I watch?
import http.client import json import math connection = http.client.HTTPConnection('api.football-data.org') connection.request('GET', '/alpha/soccerseasons/354/fixtures', headers={'X-Auth-Token': '3b7ddd493b2c461eb8ba75984800efc3'}) data = json.loads(connection.getresponse().read().decode()) fixtures = (data["fixtures"]) matchday = False fix = 379 while matchday == False: if fixtures[fix]['result']['goalsAwayTeam'] == -1: fix = fix -1 else: matchday = fixtures[fix]['matchday'] dict = {} for key in fixtures: if key["matchday"] == matchday: goals = goal_dif = 0.0 goals = key['result']['goalsAwayTeam'] + key['result']['goalsHomeTeam'] goal_dif = math.fabs(key['result']['goalsAwayTeam'] - key['result']['goalsHomeTeam']) if goal_dif > 0: dict[key['homeTeamName']+" v "+key['awayTeamName']] = goals/goal_dif else: dict[key['homeTeamName']+" v "+key['awayTeamName']] = goals print(sorted(dict, key=dict.get, reverse = True))
run
|
edit
|
history
|
help
0
My wall
Ваня и забор
nnn
Type
WORD THING
reverse the number
Lesson 2
Hello world
inerse_matrix_gauss_jordan
Lottorekke med statestikk