title: Create all combination of IPL cricket teams with validation criteria
body: <p>So, I place bets on Dream11 app. In the app, you have to select your team of 11 out of playing 22 players. It has some constraints on a valid team.</p>
  <p>Constraints(eg. CSK vs. MI):
  <br>Number of wicket keepers can be from 1 to 4
  <br>Number of batsmen can be from 3 to 6
  <br>Number of allrounders can be from 1 to 4
  <br>Number of bowlers can be from 3 to 6
  <br>Number of players selected from CSK should be less than equal to 7
  <br>Number of players selected from MI should be less than equal to 7
  <br>Sum Credits of all the selected players should be less than equal to 100</p>
  <p>Now the thing is that sometimes creating these team becomes a really difficult task when they release the lineups and a lot of players you selected are not playing or when one of the playing team is way stronger than other. So, I thought of making a program in which I can input the playing 22 and I can get all the valid teams of 11 players that I can make.</p>
  <p>Here is the input file format:
  <br>(The first line is just for reference, it's not there in the original file. Every column is tab-separated because it is easy to copy-paste from Excel that way.)
      
  <hr />
  <pre><code>#Name   #Credit   #Team1   #Team2   #WK   #BAT   #ALL   #BOWL   #Sel
  Glenn Maxwell   8.5 1   0   0   0   1   0   0
  Chris Woakes    9   0   1   0   0   1   0   0
  Mitchell Marsh  8   1   0   0   0   1   0   0
  Marcus Stoinis  8.5 1   0   0   0   1   0   0
  Jonny Bairstow  9.5 0   1   1   0   0   0   0
  Jos Buttler 9.5 0   1   1   0   0   0   0
  Alex Carey  8.5 1   0   1   0   0   0   0
  Eoin Morgan 9   0   1   0   1   0   0   0
  Sam Billings    8   0   1   0   1   0   0   0
  Joe Root    10  0   1   0   1   0   0   0
  David Warner    10  1   0   0   1   0   0   0
  Aaron Finch 9.5 1   0   0   1   0   0   0
  Marnus Labuschagne  8.5 1   0   0   1   0   0   0
  Jason Roy   9   0   1   0   1   0   0   0
  Jofra Archer    9   0   1   0   0   0   1   0
  Tom Curran  8.5 0   1   0   0   0   1   0
  Adil Rashid 9   0   1   0   0   0   1   0
  Mark Wood   8.5 0   1   0   0   0   1   0
  Josh Hazlewood  8.5 1   0   0   0   0   1   0
  Mitchell Starc  9   1   0   0   0   0   1   0
  Pat Cummins 9   1   0   0   0   0   1   0
  Adam Zampa  8.5 1   0   0   0   0   1   0
  </code></pre>
  <p>The Credit column has credit for the respective player. In all other columns, 0 represents that the respective player is not that thing and 1 represents that the respective player is that thing(eg. 1 in Team1 column represents that player is in Actual Playing Team 1 and 1 in the WK column represents that player is wicket-keeper.)</p>
  <p>Here is what I programmed to do this task.</p>
  <pre><code>import itertools
  ValidTeam = []
  with open(&quot;Players.txt&quot;, &quot;r&quot;) as dfile:
      players = [t for t in dfile.read().split(&quot;\n&quot;)]
  combos = list(itertools.combinations(players, 11))
  for combo in combos:
      crd, t1, t2, wk, bat, alr, bowl = 0, 0, 0, 0, 0, 0, 0
      for tplayer in combo:
          player = tplayer.split(&quot;\t&quot;)
          crd += float(player[1])
          t1 += int(player[2])
          t2 += int(player[3])
          wk += int(player[4])
          bat += int(player[5])
          alr += int(player[6])
          bowl += int(player[7])
      if crd &lt;= 100 and t1 &lt;= 7 and t2 &lt;= 7 and (wk in range(1,5)) and (bat in range(3,7)) and (alr in range(1,5)) and (bowl in range(3,7)):
          ValidTeam.append(combo)
          print(player)
      print(&quot;&quot;)
  print(ValidTeam)
  </code></pre>
  <p>Now the problem is for some reason that I don't understand it is showing this error message</p>
  <pre><code>Traceback (most recent call last):
    File &quot;C:\Users\RACHIT\Desktop\TM.py&quot;, line 12, in &lt;module&gt;
      crd += float(player[1])
  IndexError: list index out of range
  </code></pre>
  <p>Please, help me out with this problem.
  Also, since there will be 22C11 possible teams and for the future, chosen captains and vice-captains have special privileges so that makes it 2! * 22C11, plus the validation part of that many teams, plus I'm thinking of processing those valid teams too in future to choose the best out of them, so it can take a lot of time to process. So ideas to make it faster, efficient and better will be much appreciated and welcomed.</p>
  <p>PS: I'm using itertools for the first time so don't have much idea about it but it so really convenient.