File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ '''
2+ Problem statement
3+ Print the following pattern
4+
5+ Pattern for N = 4
6+
7+ *000*000*
8+ 0*00*00*0
9+ 00*0*0*00
10+ 000***000
11+ Detailed explanation ( Input/output format, Notes, Images )
12+ Sample Input 1 :
13+ 3
14+ Sample Output 1 :
15+ *00*00*
16+ 0*0*0*0
17+ 00***00
18+ Sample Input 2 :
19+ 5
20+ Sample Output 2 :
21+ *0000*0000*
22+ 0*000*000*0
23+ 00*00*00*00
24+ 000*0*0*000
25+ 0000***0000
26+ '''
27+
28+ from os import *
29+ from sys import *
30+ from collections import *
31+ from math import *
32+
33+ n = int (input ())
34+
35+ for i in range (1 , n + 1 ):
36+ for o in range (1 , i ):
37+ print ("0" , end = "" )
38+ print ("*" , end = "" )
39+ for o in range (1 , n - i + 1 ):
40+ print ("0" , end = "" )
41+ print ("*" , end = "" )
42+ for o in range (1 , n - i + 1 ):
43+ print ("0" , end = "" )
44+ print ("*" , end = "" )
45+ for o in range (1 , i ):
46+ print ("0" , end = "" )
47+ print ()
48+
You can’t perform that action at this time.
0 commit comments