write a program to print W pattern of n lines using an asterisk charecter (*)
n = int(input())
for i in range(n):
lst = [' '] * (4 * n - i - 2)
lst[i: 2 * n - i] = ['*', ' '] * (n - i)
lst[i + 2 * n - 2:4 * n - i - 2] = ['*', ' '] * (n - i)
print(''.join(lst))
Comments
Leave a comment