Skip to content

Commit d2b0527

Browse files
committed
Add butterfly pattern implementation
1 parent 12b1023 commit d2b0527

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

graphics/butterfly_pattern.py

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
def butterfly_pattern(n):
2+
# Üst kısım
3+
for i in range(1, n + 1):
4+
print("*" * i, end="")
5+
print(" " * (2 * (n - i)), end="")
6+
print("*" * i)
7+
8+
# Alt kısım
9+
for i in range(n-1, 0, -1):
10+
print("*" * i, end="")
11+
print(" " * (2 * (n - i)), end="")
12+
print("*" * i)
13+
14+
n = int(input("Enter the size: "))
15+
butterfly_pattern(n)

0 commit comments

Comments
 (0)