for i in range(9):
for j in range(9):
print(modifiedSentence[i][j], end=" ")
print()
modifiedSentence =
7 8 1 2 6 9 3 4 5
3 2 4 7 1 5 6 9 8
5 6 9 4 3 8 1 2 7
2 9 7 3 5 4 8 1 6
4 5 3 1 8 6 9 7 2
8 1 6 9 7 2 5 3 4
9 3 8 6 4 7 2 5 1
6 4 2 5 9 1 7 8 3
1 7 5 8 2 3 4 6 9
and i want it :
7 8 1 2 6 9 3 4 5
3 2 4 7 1 5 6 9 8
5 6 9 4 3 8 1 2 7
2 9 7 3 5 4 8 1 6
4 5 3 1 8 6 9 7 2
8 1 6 9 7 2 5 3 4
9 3 8 6 4 7 2 5 1
6 4 2 5 9 1 7 8 3
1 7 5 8 2 3 4 6 9
means every box in this sudoku has a emptiness in his colum and row as a box
You need to add a space every third iteration of the inner loop, and a newline every 3rd iteration of the outer loop:
for i in range(9):
if i > 0 and i % 3 == 0:
print("")
for j in range(9):
if j > 0 and j % 3 == 0:
print("", end = " ")
print(modifiedSentence[i][j], end=" ")
print()