File tree Expand file tree Collapse file tree 1 file changed +40
-1
lines changed Expand file tree Collapse file tree 1 file changed +40
-1
lines changed Original file line number Diff line number Diff line change 8
8
" Print the following pattern for the given number of rows.<br>\n " ,
9
9
" Note: N is always odd.<br>\n " ,
10
10
" Pattern for N = 5<br>\n " ,
11
- " <br>\n " ,
11
+ " <br>\n " ,
12
12
" The dots represent spaces.<br>\n " ,
13
13
" Input format :<br>\n " ,
14
14
" N (Total no. of rows and can only be odd)<br>\n " ,
67
67
" print()\n " ,
68
68
" currRow-=1"
69
69
]
70
+ },
71
+ {
72
+ "cell_type" : " code" ,
73
+ "execution_count" : 1 ,
74
+ "metadata" : {},
75
+ "outputs" : [
76
+ {
77
+ "name" : " stdout" ,
78
+ "output_type" : " stream" ,
79
+ "text" : [
80
+ " 9\n " ,
81
+ " *\n " ,
82
+ " ***\n " ,
83
+ " *****\n " ,
84
+ " *******\n " ,
85
+ " *********\n " ,
86
+ " *******\n " ,
87
+ " *****\n " ,
88
+ " ***\n " ,
89
+ " *\n "
90
+ ]
91
+ }
92
+ ],
93
+ "source" : [
94
+ " #Another Solution\n " ,
95
+ " n=int(input())\n " ,
96
+ " first=n//2+1\n " ,
97
+ " sec=n//2\n " ,
98
+ " #first loop\n " ,
99
+ " for i in range(1,first+1):\n " ,
100
+ " print(\" \" *(first-i),end=\"\" )\n " ,
101
+ " print((2*i-1)*\" *\" ,end=\"\" )\n " ,
102
+ " print()\n " ,
103
+ " #Second Loop\n " ,
104
+ " for p in range(1,sec+1):\n " ,
105
+ " print(\" \" *p,end=\"\" )\n " ,
106
+ " print((2*(sec-p+1)-1)*\" *\" ,end=\"\" )\n " ,
107
+ " print()"
108
+ ]
70
109
}
71
110
],
72
111
"metadata" : {
You can’t perform that action at this time.
0 commit comments