Last active
April 4, 2024 18:03
-
-
Save gianni-di-noia/4560059 to your computer and use it in GitHub Desktop.
Algoritmo di Berger
This file contains 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
squadre = ['roma', 'juve', 'lazio', 'milan', 'inter', 'samp', | |
'genoa', 'catania', 'bari', 'atalanta', 'andria', 'barletta', 'chievo', | |
'pescara', 'fiorentina', 'palermo', 'napoli', 'siena', 'udine', 'bologna'] | |
numero_squadre = len(squadre) | |
giornate = len(squadre) - 1 | |
def AlgoritmoDiBerger(squadre): | |
if not numero_squadre % 2 == 0: | |
squadre.append('riposo') | |
i = 0 | |
while i < giornate: | |
print str(i + 1) + "a Giornata" | |
j = 0 | |
while j < (numero_squadre / 2): | |
print squadre[j] + ' - ' + squadre[giornate - j] | |
print squadre[giornate - j] + ' - ' + squadre[j] | |
j += 1 | |
i += 1 | |
print "\n" | |
AlgoritmoDiBerger(squadre) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Non funziona perché dà sempre la stessa giornata