|
75 | 75 | "metadata": {},
|
76 | 76 | "outputs": [],
|
77 | 77 | "source": [
|
78 |
| - "def <FUNCTION-NAME>():\n", |
79 |
| - " \"\"\" \n", |
| 78 | + "def function_name():\n", |
| 79 | + " \"\"\"\n", |
80 | 80 | " Prints the following pattern for `n` rows:\n",
|
81 |
| - " \n", |
| 81 | + "\n", |
82 | 82 | " 1\n",
|
83 | 83 | " 1 2\n",
|
84 | 84 | " 1 2 3\n",
|
85 | 85 | " ...\n",
|
86 | 86 | " 1 2 3 ... n\n",
|
87 |
| - " \n", |
| 87 | + "\n", |
88 | 88 | " Parameters\n",
|
89 | 89 | " ----------\n",
|
90 | 90 | " n : integer\n",
|
91 | 91 | " Number of lines\n",
|
92 |
| - " \n", |
| 92 | + "\n", |
93 | 93 | " Ideas\n",
|
94 | 94 | " -----\n",
|
95 | 95 | " Looping, Nested Loops\n",
|
|
119 | 119 | "metadata": {},
|
120 | 120 | "outputs": [],
|
121 | 121 | "source": [
|
122 |
| - "def <FUNCTION-NAME>():\n", |
123 |
| - " \"\"\" \n", |
| 122 | + "def function_name():\n", |
| 123 | + " \"\"\"\n", |
124 | 124 | " Prints the following pattern forever (till interrupt):\n",
|
125 |
| - " \n", |
| 125 | + "\n", |
126 | 126 | " *\n",
|
127 | 127 | " 00\n",
|
128 | 128 | " ***\n",
|
|
132 | 132 | " ***\n",
|
133 | 133 | " 00\n",
|
134 | 134 | " *\n",
|
135 |
| - " \n", |
136 |
| - " This is a vertical sinusoid.\n", |
137 |
| - " \n", |
138 |
| - " Parameters\n", |
139 |
| - " ----------\n", |
140 |
| - " n : integer\n", |
141 |
| - " Number of lines\n", |
142 |
| - " \n", |
| 135 | + "\n", |
143 | 136 | " Ideas\n",
|
144 | 137 | " -----\n",
|
145 | 138 | " Looping, Conditions\n",
|
|
171 | 164 | "metadata": {},
|
172 | 165 | "outputs": [],
|
173 | 166 | "source": [
|
174 |
| - "def <FUNCTION-NAME>():\n", |
175 |
| - " \"\"\" \n", |
| 167 | + "def function_name():\n", |
| 168 | + " \"\"\"\n", |
176 | 169 | " Prints the following pattern forever (till interrupt):\n",
|
177 |
| - " \n", |
178 |
| - " **\n", |
179 |
| - " ***\n", |
180 |
| - " *****\n", |
181 |
| - " *******\n", |
182 |
| - " ********\n", |
183 |
| - " *********\n", |
184 |
| - " *********\n", |
185 |
| - " ********\n", |
186 |
| - " *******\n", |
187 |
| - " *****\n", |
188 |
| - " ***\n", |
| 170 | + "\n", |
189 | 171 | " **\n",
|
190 |
| - " **\n", |
191 |
| - " ***\n", |
192 |
| - " *****\n", |
193 |
| - " *******\n", |
194 |
| - " ********\n", |
195 |
| - " *********\n", |
196 |
| - " *********\n", |
197 |
| - " ********\n", |
198 |
| - " *******\n", |
199 |
| - " *****\n", |
200 |
| - " ***\n", |
| 172 | + " ****\n", |
| 173 | + " ******\n", |
| 174 | + " ******\n", |
| 175 | + " ******\n", |
| 176 | + " ****\n", |
201 | 177 | " **\n",
|
202 | 178 | " \n",
|
203 |
| - " This is a vertical sinusoid. \n", |
| 179 | + " This is a vertical sinusoid. Use the `math.sin` function here.\n", |
204 | 180 | " Note that your output need not look exactly like this.\n",
|
205 | 181 | " \n",
|
206 | 182 | " Parameters\n",
|
|
269 | 245 | "metadata": {},
|
270 | 246 | "outputs": [],
|
271 | 247 | "source": [
|
272 |
| - "def <FUNCTION-NAME>():\n", |
| 248 | + "def function_name():\n", |
273 | 249 | " \"\"\"\n",
|
274 | 250 | " For all elements in `keys`, print the value associated with them in `dictionary`.\n",
|
275 | 251 | " Use exception handling to take care of a non-existent key, and print the value \n",
|
276 |
| - " associated with `other` instead.\n", |
277 |
| - " \n", |
| 252 | + " associated with `other` instead. Use exception handling.\n", |
| 253 | + "\n", |
278 | 254 | " Ideas\n",
|
279 | 255 | " -----\n",
|
280 | 256 | " try, except\n",
|
|
313 | 289 | "metadata": {},
|
314 | 290 | "outputs": [],
|
315 | 291 | "source": [
|
316 |
| - "def <FUNCTION-NAME>():\n", |
| 292 | + "def function_name():\n", |
317 | 293 | " \"\"\"\n",
|
318 | 294 | " Round off values in `data` below the mean to 0, and those above the mean to 1\n",
|
319 | 295 | " Do not use looping statements.\n",
|
320 |
| - " \n", |
| 296 | + "\n", |
321 | 297 | " Ideas\n",
|
322 | 298 | " -----\n",
|
323 | 299 | " lambda, map\n",
|
|
347 | 323 | "metadata": {},
|
348 | 324 | "outputs": [],
|
349 | 325 | "source": [
|
350 |
| - "def <FUNCTION-NAME>():\n", |
| 326 | + "def function_name():\n", |
351 | 327 | " \"\"\"\n",
|
352 | 328 | " Return a list of all perfect squares less than `n`, using list comprehension.\n",
|
353 |
| - " \n", |
| 329 | + "\n", |
354 | 330 | " Parameters\n",
|
355 | 331 | " ----------\n",
|
356 | 332 | " n : integer\n",
|
357 | 333 | " Limit value\n",
|
358 |
| - " \n", |
| 334 | + "\n", |
359 | 335 | " Ideas\n",
|
360 | 336 | " -----\n",
|
361 | 337 | " Looping, If, List Comprehension\n",
|
|
0 commit comments