W pattern with *
Write a program to print
The first line is an integer
For
N = 5The output should be
* * * * * * * * *
* * * * * * * *
* * * * * *
* * * *
* *
n = int(input())
for i in range(n):
lst = [' '] * (4 * n - i - 3)
lst[i] = lst[i + 2 * n - 2] = lst[-1] = lst[-1 - 2 * n + 2] = '*'
print(''.join(lst))
Comments
Leave a comment