I am making a N-queens algorithm (The eight queens puzzle is the problem of placing eight chess queens on an 8×8 chessboard so that no two queens threaten each other; thus, a solution requires that no two queens share the same row, column, or diagonal) and this is the “Outside”, not the algorithm: But it gives me an error (listed after the huge code) and I printed each thing, and 5 is within 8.

```
a = (0, 0, 0, 0, 0, 0, 0, 0)
b = (0, 0, 0, 0, 0, 0, 0, 0)
c = (0, 0, 0, 0, 0, 0, 0, 0)
d = (0, 0, 0, 0, 0, 0, 0, 0)
e = (0, 0, 0, 0, 0, 0, 0, 0)
f = (0, 0, 0, 0, 0, 0, 0, 0)
g = (0, 0, 0, 0, 0, 0, 0, 0)
h = (0, 0, 0, 0, 0, 0, 0, 0)
board = (a,b,c,d,e,f,g,h)
for row in board:
for elem in row:
print(elem, end=' ')
print()
#ask for first queen position
firstq_x = int(input('What is x of first queen: '))
print(firstq_x)
firstq_y = int(input('What is y of first queen: '))
print(firstq_y)
#board(firstq_y) and board(firstq_y(firstq_x))
y = board(int(firstq_y)-1) # y is the selection of a,b,c,d,e,f,g, or h.
y(int(firstq_x)-1) = 'Q' # y(int(firstq_x)-1) is the selection of 0's based on y.
for row in board:
for elem in row:
print(elem, end=' ')
print()
#horizontal
for floor in range(8):
if y(floor) == 0:
y(floor) = "X"
#vertical
board = (a,b,c,d,e,f,g,h)
count = 0
for vert in range(len(board)):
vertical = board(count)
if vertical(firstq_x-1) == 0:
vertical(firstq_x-1) = "X"
count+=1
#NW
#find y first
ytofill = 2
yminus1 = board(firstq_y-ytofill) #this will give us list before current list
#find x next
xtofill = 1
xminus1 = yminus1(firstq_x-xtofill) #this will give us letter before letter
#execute
if firstq_y>firstq_x:
for NW in range(firstq_x):
if yminus1(firstq_x-xtofill) == 0:
yminus1(firstq_x-xtofill) = 'X'
yminus1 = board(firstq_y-ytofill)
xtofill+=1
ytofill+=1
else:
for NW in range(firstq_y):
if yminus1(firstq_x-xtofill) == 0:
yminus1(firstq_x-xtofill) = 'X'
yminus1 = board(firstq_y-ytofill)
xtofill+=1
ytofill+=1
#NE
#find y first
ytofill = 2
yminus1 = board(firstq_y-ytofill) #this will give us list before current list
#find x next
xtofill = 1
xminus1 = yminus1(firstq_x-xtofill) #this will give us letter before letter
#execute
if firstq_y>firstq_x:
for NE in range(firstq_y):
if yminus1(firstq_x-xtofill) == 0:
yminus1(firstq_x-xtofill) = 'X'
yminus1 = board(firstq_y-ytofill)
xtofill-=1
ytofill+=1
else:
for NE in range(firstq_x):
if yminus1(firstq_x-xtofill) == 0:
yminus1(firstq_x-xtofill) = 'X'
yminus1 = board(firstq_y-ytofill)
xtofill-=1
ytofill+=1
board = (a,b,c,d,e,f,g,h)
for row in board:
for elem in row:
print(elem, end=' ')
print()
```

However, it gives me the error:

```
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-4-cb78dab39eae> in <module>()
54
55 for NE in range(firstq_y):
---> 56 if yminus1(firstq_x-xtofill) == 0:
57 yminus1(firstq_x-xtofill) = 'X'
58 yminus1 = board(firstq_y-ytofill)
IndexError: list index out of range
```
```