Created
January 13, 2014 19:32
-
-
Save Beneboe/8406488 to your computer and use it in GitHub Desktop.
Erzeugung eines Turnierplans
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def range(start, stop, step = 1): | |
x = start | |
while True: | |
if x >= stop: return | |
yield x | |
x += step | |
# Erzeugung eines Turnierplans mit n Teilnehmern | |
# Eingabe von n | |
n = int(input('Anzahl der Teilnehmer: ')) | |
# Erzeugung und Ausgabe der Spielpaarungen | |
for i in range(0, n - 1): | |
print('Runde ' + str(i + 1) + ':') | |
print(n - 1, ':', i) | |
for j in range(1, n / 2): | |
a = (i - j + n - 1) % (n - 1) | |
b = (i + j - n + 1) % (n - 1) | |
print(a, ':', b) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment