Digit 9
You are given N as input. Write a program to print the pattern of 2*N - 1 rows using an asterisk(*) as shown below.
Note: There is a space after each asterisk * character.
N = int(input())
first_line = '*' * N
first_line = ' '.join(first_line)
nine = first_line
for i in range(N - 2):
nine += '\n' + '*' + (' ' * (2*N - 3)) + '*'
nine += '\n' + first_line
for i in range(N - 2):
nine += '\n' + (' ' * (2*N - 2)) + '*'
nine += '\n' + first_line
print(nine)
Comments
Leave a comment