Enter integer here: 5
. . . . 0 . . . .
. . . 0 0 0 . . .
. . 0 0 0 0 0 . .
. 0 0 0 0 0 0 0 .
0 0 0 0 0 0 0 0 0
. 0 0 0 0 0 0 0 .
. . 0 0 0 0 0 . .
. . . 0 0 0 . . .
. . . . 0 . . . .
can i get code for this please,
using for loop
n = 11
if n%2 == 1:
for i in range(1,n,2):
i = '.' * ((n-i)//2) + '0' *i + '.' * ((n-i)//2)
print (i)
for i in range(n,0,-2):
i = '.' * ((n-i)//2) + '0' *i + '.' * ((n-i)//2)
print (i)
Comments
Leave a comment