Digit 9
You are given
The first line of input is an integer
In the given example,
N = 4.So, the output should be
* * * *
* *
* *
* * * *
*
*
* * * *
Sample Input 1
4
Sample Output 1
* * * *
* *
* *
* * * *
*
*
* * * *
N=int(input())
rows=2*N - 1
for r in range(0,rows):
for c in range(0,N):
if r>0 and r<rows-1 and r!=N-1:
if c>0 and c<N-1:
print(" ",end=" ")
else:
if r>=N and r<rows-1 and c==0:
print(" ",end=" ")
else:
print("* ",end=" ")
else:
print("* ",end=" ")
print("\n")
Comments
Leave a comment