dimanche 3 janvier 2016

All possbile outcomes, loop required

Essentially I have all premier league teams

teamlist = ["arsenal", "aston-villa", "bournemouth", "chelsea", "crystal-palace", "everton","leicester-city", "liverpool", "manchester-city", "manchester-united", "newcastle-united", "norwich-city", "southampton","stoke-city", "swansea-city", "tottenham-hotspur", "watford", "west-bromich-albion","west-ham-united" ]

which I need to output as all possible fixtures in the format team1-vs-team2 for the sake of scraping results from a site.

At present I have the following

teamlist = ["arsenal", "aston-villa", "bournemouth", "chelsea", "crystal-palace", "everton","leicester-city", "liverpool", "manchester-city", "manchester-united", "newcastle-united", "norwich-city", "southampton","stoke-city", "swansea-city", "tottenham-hotspur", "watford", "west-bromich-albion","west-ham-united" ]

oppo = 0

for team in teamlist:
        print team + "-vs-" + teamlist[oppo]
        oppo+=1
        print team + "-vs-" + teamlist[oppo]
        oppo+=1

which will output:

arsenal-vs-arsenal
arsenal-vs-aston-villa

However I need this to go through each team, display all of their possible home game fixtures, then move onto the next team in teamlist, output all of their possible home games fixtures and repeat until all teams are done.

Aucun commentaire:

Enregistrer un commentaire