Input:-
Output:-
num
= int(input("Enter the number of pattern:"))
def
pattern(n):
for i in range(1, n + 1):
for j in range(1, 2 * n + 1):
if (i < j):
print("", end =
" ");
else:
print("*", end =
"");
if (i <= ((2 * n) - j)):
print("", end =
" ");
else:
print("*", end = "");
print("");
for i in range(1, n + 1):
for j in range(1, 2 * n + 1):
if (i > (n - j + 1)):
print("", end =
" ");
else:
print("*", end =
"");
if ((i + n) > j):
print("", end = " ");
else:
print("*", end =
"");
print("");
pattern(num);
Output:-
No comments:
Post a Comment