#Print the user board
s = ''
for i in range(n):
for j in range(n):
z = i * n + j
s += ' '
if z < 10:
s += ' '
s += str(z)
s += '\n'
print(dedent(s))
queens = list(map(int, input("Queens: ").split()))
I keep getting an error from my testcase environment of a last blank line before proceeding to the queens input below. What can I approach to fix
I have tried cleandoc from textwrap and while it works, it disrupts every required spacing and new distinctive lines for z from the "s" string which is a perfect 8 by 8 from 0 to 63.
>Solution :
Creating the right way instead of removing things after is easier:
from itertools import count
import toolz
n = 8
start_value = 0
counter = count(start_value)
rows = [" ".join(f"{num:2}" for num in toolz.take(n, counter)) for _ in range(n)]
print("\n".join(rows))