File tree 1 file changed +44
-0
lines changed
1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change
1
+ __author__ = 'Avinash'
2
+
3
+
4
+ # Python3 program to print alphabet pattern G
5
+
6
+ # * * * * * *
7
+ # *
8
+ # *
9
+ # * * * * * *
10
+ # * *
11
+ # * *
12
+ # * *
13
+ # * * * * * *
14
+
15
+ def print_pattern (n ):
16
+ # Outer for loop for number of rows
17
+ for rows in range (n ):
18
+
19
+ # Inner for loop columns
20
+ for columns in range (n ):
21
+
22
+ # prints first row
23
+ if ((rows == 0 and (columns != 0 and columns != n - 1 )) or
24
+ # prints last row
25
+ (rows == n - 1 and (columns != 0 and columns != n - 1 )) or
26
+ # prints first column
27
+ ((columns == 0 and (rows != 0 and rows != n - 1 )) or
28
+ # prints last column
29
+ (columns == n - 1 and rows != n - 1 and rows >= (n / 2 )- 1 )) or
30
+ # prints middle column
31
+ (rows == (n / 2 )- 1 and ((n / 2 )- 1 <= columns < n - 1 ))
32
+ ):
33
+ print ("*" , end = " " )
34
+ else :
35
+ print (" " , end = " " )
36
+ print ()
37
+
38
+
39
+ size = int (input ("Enter size: \t " ))
40
+
41
+ if size < 8 :
42
+ print ("Enter a size greater than 8" )
43
+ else :
44
+ print_pattern (size )
You can’t perform that action at this time.
0 commit comments