In Python, i want to print concentric square for that i have written a code but i am not getting desired output

前端 未结 4 2032
伪装坚强ぢ
伪装坚强ぢ 2021-01-16 20:01

input n taken here

n=int(input())

answer=[[1]]

for i in range(2, n+1):

    t=[i]*((2*i)-3)
    answer.insert(0, t)
    answer.append(t)
    for a in answ         


        
4条回答
  •  说谎
    说谎 (楼主)
    2021-01-16 20:21

    Using

    for i in range(2*n-1):
        print()
        for j in range(len(answerfinal[i])):
            print(answerfinal[i][j], end='')
    

    instead of

    for a in answerfinal:
        print(a)
    

    might help.

提交回复
热议问题