File tree Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Expand file tree Collapse file tree 1 file changed +47
-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 K
5
+
6
+ # * *
7
+ # * *
8
+ # * *
9
+ # * *
10
+ # * *
11
+ # * *
12
+ # * *
13
+ # * *
14
+ # * *
15
+ # * *
16
+ # * *
17
+ # * *
18
+
19
+
20
+ def print_pattern (n ):
21
+
22
+ i = 0
23
+ j = n // 2
24
+ # Outer for loop for number of rows
25
+ for rows in range (n ):
26
+
27
+ # Inner for loop columns
28
+ for columns in range (n ):
29
+
30
+ # prints first and last column
31
+ if columns == 0 or (rows == (columns + (n // 3 )) and columns > 0 ):
32
+ print ("*" , end = " " )
33
+ elif rows == i and columns == j :
34
+ print ("*" , end = " " )
35
+ i = i + 1
36
+ j = j - 1
37
+ else :
38
+ print (" " , end = " " )
39
+ print ()
40
+
41
+
42
+ size = int (input ("Enter size: \t " ))
43
+
44
+ if size < 8 :
45
+ print ("Enter a size greater than 8" )
46
+ else :
47
+ print_pattern (size )
You can’t perform that action at this time.
0 commit comments