given an integer N as input write a program to print a shaded diamond of 2*N -1 rows using an asterisk(*) .
n = int(input())
for i in range(n):
lst = [' '] * (2 * n - 1)
lst[n - 1 - i] = '*'
lst[-n + i] = '*'
print(*lst, sep='')
for i in range(n - 2, -1, -1):
lst = [' '] * (2 * n - 1)
lst[n - 1 - i] = '*'
lst[-n + i] = '*'
print(*lst, sep='')
Comments
Leave a comment