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