kyu_5.sports_league_table_ranking package¶
Submodules¶
kyu_5.sports_league_table_ranking.compute_ranks module¶
-
kyu_5.sports_league_table_ranking.compute_ranks.
calc_for_against
(teams, team, team_1, team_2) → None[source]¶ Collect “For:Against” data
- Parameters
teams –
team –
team_1 –
team_2 –
- Returns
-
kyu_5.sports_league_table_ranking.compute_ranks.
calc_gd
(teams) → None[source]¶ Calculates “GD”
- Parameters
teams –
- Returns
-
kyu_5.sports_league_table_ranking.compute_ranks.
calc_rank
(teams: dict) → None[source]¶ Calculates Rank
First you sort the teams by their points. If two or more teams reached the same number of points, the second criteria comes into play and so on. Finally, if all criteria are the same, the teams share a place.
- Parameters
teams –
- Returns
-
kyu_5.sports_league_table_ranking.compute_ranks.
calc_team_points
(team, teams, score_a, score_b) → None[source]¶ Calculates team points
- Parameters
team –
teams –
score_a –
score_b –
- Returns
-
kyu_5.sports_league_table_ranking.compute_ranks.
calc_teams_score
(team_a, team_b, teams, team, number) → None[source]¶ - Calculate following:
For : Against Points
Set default values for team as well
- Parameters
team_a –
team_b –
teams –
team –
number –
- Returns
-
kyu_5.sports_league_table_ranking.compute_ranks.
compute_ranks
(number: int, games: list) → list[source]¶ organize a sports league in a round-robin-system. Each team meets all other teams. In your league a win gives a team 2 points, a draw gives both teams 1 point. After some games you have to compute the order of the teams in your league. You use the following criteria to arrange the teams:
Points Scoring differential (the difference between goals scored and those conceded)
Goals scored First you sort the teams by their points. If two or more teams reached the same number of points, the second criteria comes into play and so on. Finally, if all criteria are the same, the teams share a place.
- Parameters
number –
games –
- Returns
kyu_5.sports_league_table_ranking.test_compute_ranks module¶
-
class
kyu_5.sports_league_table_ranking.test_compute_ranks.
ComputeRanksTestCase
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
-
test_something
()[source]¶ Test the function that organizes a sports league in a round-robin-system. Each team meets all other teams. In your league a win gives a team 2 points, a draw gives both teams 1 point. After some games you have to compute the order of the teams in your league. You use the following criteria to arrange the teams:
Points
Scoring differential (the difference between goals scored and those conceded)
Goals scored
- Returns
-