10000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 742bb06 commit 07bdefbCopy full SHA for 07bdefb
patterns/pattern-b.py
@@ -0,0 +1,39 @@
1
+__author__ = 'Avinash'
2
+
3
+# Python3 program to print alphabet B pattern
4
5
+# Function to display alphabet pattern
6
7
8
+def print_pattern(n):
9
+ # Outer for loop for number of lines(rows)
10
+ for i in range(n):
11
12
+ # Inner for loop for logic execution
13
+ for j in range(n + 1):
14
15
+ # prints two column lines
16
+ if ((j == 0 or j == n) or
17
18
+ # print first line of alphabet
19
+ i == 0 and j != 0 and j != n or
20
21
+ # prints last line
22
+ i == n - 1 or
23
24
+ # prints middle line
25
+ i == n // 2):
26
+ print("*", end="")
27
+ else:
28
+ print(" ", end="")
29
30
+ print()
31
32
33
+# Size of the letter
34
+num = int(input("Enter the size: \t "))
35
36
+if num > 7:
37
+ print_pattern(num)
38
+else:
39
+ print("Enter a size minimum of 8")
0 commit comments