Skip to main content

exercise_tournament.py


"""
Exercise: Tournament
Write a program which prints out different
permutations of matches between players A B C D
Hint :
a simple way of listing the permutation of games is :
A-B A-C A-D
B-C B-D
C-D
Author: Lauren Gregoire
"""
teams=('A','B','C','D')
matches=[]
team1=0
while team1<len(teams):
    team2=team1+1    # start
    while team2<len(teams):
        matches.append((teams[team1],teams[team2]))
        team2+=1
    team1+=1
print matches