Generally runs but sometimes gives an index error | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Generally runs but sometimes gives an index error

I want to make a program that randomly simulates the flow of a champions league tournament (football/soccer tournament). The format of the tournament is as follows: There are 32 teams that qualify each year. The teams are then randomly distributed into 8 groups containing 4 teams each. The teams all play each other and 2 of the best performing ones qualify to the next round (round of sixteen) The matchups are decided by randomly selecting the teams 2 at a time with the constraint that no two teams from the same group may face each other again The winner then progresses to the next stage and so on and so forth until we have a winner. In my program I have tried to implement this format using the random module in python. However, once every 4-5 iterations I get an index error at either the round of 16 selection step or the quarter final selection step. I cant seem to understand why. Please help https://code.sololearn.com/c129NBCam0jz/?ref=app https://code.sololearn.com/c129NBCam0jz/?ref=app

23rd May 2021, 3:39 AM
beastmaster64
beastmaster64 - avatar
2 Answers
+ 2
Såñtösh it works fine most of the time but sometimes it randomly gives an index error I can send you an image on dm of the error
23rd May 2021, 3:59 AM
beastmaster64
beastmaster64 - avatar
+ 1
Ok
23rd May 2021, 3:59 AM
Sâñtôsh
Sâñtôsh - avatar