File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change
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" )
You can’t perform that action at this time.
0 commit comments