Why do I get IndexError: list index out of range? <p>I keep getting the <code>IndexError</code> with a list. My code looks like this:</p> <pre><code>for x in range(len(MAIN_list[0])): print(x) print(MAIN_list[9][x]) print(MAIN_list[10][x]) print(MAIN_list[0][x] + "; " + MAIN_list[1][x] + \ "; " + MAIN_list[2][x] + "; " + MAIN_list[3][x] + \ "; " + MAIN_list[4][x] + "; " + MAIN_list[5][x] + \ "; " + MAIN_list[6][x] + "; " + MAIN_list[7][x] + \ "; " + MAIN_list[8][x] + "; " + MAIN_list[9][x] + \ "; " + MAIN_list[10][x]) </code></pre> <p>Now, the output is:</p> <pre><code>0 cross tick Traceback (most recent call last): File "C:\Users\Michele2\Desktop\Arcrate\MyCASH\Python Code\Scraping\Scraping1.3(clean)TEST.py", line 246, in &lt;module&gt; "; " + MAIN_list[10][x]) IndexError: list index out of range </code></pre> <p>I know that you'd usually get this error for variables outside the actual length of the list, but here I get the right output when I call it singularly (ie. row 3 of the output) but not when I try to print the list as a whole. Any though would be welcome.</p> <p>Thanks</p>