Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import itertools
- porto = ["Portugal", "A"]
- arsenal = ["England", "B"]
- milan = ["Italy", "C"]
- madrid = ["Spain", "D"]
- donetsk = ["Ukraine", "E"]
- valencia = ["Spain", "F"]
- celtic = ["Scotland", "G"]
- galatasaray = ["Turkey", "H"]
- psg = ["France", "A"]
- schalke = ["Germany", "B"]
- malaga = ["Spain", "C"]
- dortmund = ["Germany", "D"]
- juve = ["Italy", "E"]
- munich = ["Germany", "F"]
- barca = ["Spain", "G"]
- manu = ["England", "H"]
- first = [psg,schalke,malaga,dortmund,juve,munich,barca,manu]
- second = [porto,arsenal,milan,madrid,donetsk,valencia,celtic,galatasaray]
- perms = list(itertools.permutations(second))
- possiblePerms = []
- for perm in perms:
- for index in xrange(8):
- valid = False
- if (perm[index][0] == first[index][0]) or (perm[index][1] == first[index][1]):
- break
- else:
- valid = True
- if valid is True:
- possiblePerms.append(perm)
- Tally = [[0 for i in range(8)] for j in range(8)]
- for item in possiblePerms:
- for c in xrange(8):
- if item[c] == porto:
- Tally[c][0] += 1
- if item[c] == arsenal:
- Tally[c][1] += 1
- if item[c] == milan:
- Tally[c][2] += 1
- if item[c] == madrid:
- Tally[c][3] += 1
- if item[c] == donetsk:
- Tally[c][4] += 1
- if item[c] == valencia:
- Tally[c][5] += 1
- if item[c] == celtic:
- Tally[c][6] += 1
- if item[c] == galatasaray:
- Tally[c][7] += 1
- for i in xrange(8):
- for j in xrange(8):
- tmp = float(Tally[i][j])/(len(possiblePerms))
- tmp = round(tmp,2)
- Tally[i][j] = tmp
- from pprint import pprint
- pprint(Tally)
- print len(possiblePerms)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement