[Solved] Tournament Program [closed]


The error you have comes up in your method of printing out the results:

for i in range(len(teams)):
    print(team[i],team[i+1])

First of all, you have team instead of teams in the print statement, which is actually the string where you were storing user input, and should be '-1' by the time you’re printing scores. You’re getting the string index out of range error because it’s trying to index the team string to the length of the teams list, which is likely larger than two.

Additionally, you’re going to run into a similar problem with teams[i+1] since on the last iteration it will try and access one position beyond the length of the array. You’re also going to be printing teams multiple times with how you have your loop set up, but I’ll leave that to you to figure out.

solved Tournament Program [closed]