при :while p[i][j+1] in p and p[i][j+1]==0:
j+=1
el+=1
p[i][j]=el
ошибка:Traceback (most recent call last):
File "main.py", line 28, in <module>
while p[i][j+1] in p and p[i][j+1]==0:
IndexError: list index out of range
весь код:#!/bin/python3
a=int(input())
p,f,el=[],[],a
for k in range (a):
f+=[0]
for s in range(a):
p.append(f*1)
for s in range(a):
p[0][s]=s+1
i=0
j=a-1
while a*a>=el:
while p[i+1][j] in p and p[i+1][j]==0:
i+=1
el+=1
p[i][j]=el
while p[i][j-1] in p and p[i][j-1]==0:
j-=1
el+=1
p[i][j]=el
while p[i-1][j] in p and p[i-1][j]==0:
i-=1
el+=1
p[i][j]=el
while p[i][j+1] in p and p[i][j+1]==0:
j+=1
el+=1
p[i][j]=el
for j in range(a):
print()
for pd in range(a):
print(p[j][pd],end=' ')