From 436f1ac199820a211ab9bfe8f36da9b11eb14f94 Mon Sep 17 00:00:00 2001 From: Joey Hafner Date: Tue, 13 Feb 2024 00:43:23 -0800 Subject: [PATCH] Init simplest possible round robin function --- .gitignore | 1 + round_robin.py | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 .gitignore create mode 100644 round_robin.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1d17dae --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.venv diff --git a/round_robin.py b/round_robin.py new file mode 100644 index 0000000..1aa320b --- /dev/null +++ b/round_robin.py @@ -0,0 +1,11 @@ +# take a list of teams +# return a round-robin schedule + +teams = ["Team A", "Team B", "Team C", "Team D", "Team E", "Team F", "Team G", "Team H", "Team I", "Team J"] + +# each round should have len(teams)//2 matches, as that should appropriately handle odd-numbered team counts + +for r in range(1,len(teams)): + print("Round", r) + for i in range(0,len(teams)//2): + print(f"{teams[i]} vs. {teams[i-r]}")