|
55 | 55 | },
|
56 | 56 | {
|
57 | 57 | "cell_type": "code",
|
58 |
| - "execution_count": 2, |
| 58 | + "execution_count": 1, |
59 | 59 | "metadata": {
|
60 | 60 | "collapsed": true
|
61 | 61 | },
|
|
64 | 64 | "top_travel_cities = ['Solta', 'Greenville', 'Buenos Aires', 'Los Cabos', 'Walla Walla Valley', 'Marakesh', 'Albuquerque', 'Archipelago Sea', 'Iguazu Falls', 'Salina Island', 'Toronto', 'Pyeongchang']"
|
65 | 65 | ]
|
66 | 66 | },
|
| 67 | + { |
| 68 | + "cell_type": "markdown", |
| 69 | + "metadata": {}, |
| 70 | + "source": [ |
| 71 | + "> Remember to press shift enter to run each gray block of code." |
| 72 | + ] |
| 73 | + }, |
67 | 74 | {
|
68 | 75 | "cell_type": "markdown",
|
69 | 76 | "metadata": {},
|
|
73 | 80 | },
|
74 | 81 | {
|
75 | 82 | "cell_type": "code",
|
76 |
| - "execution_count": 1, |
77 |
| - "metadata": {}, |
| 83 | + "execution_count": 2, |
| 84 | + "metadata": { |
| 85 | + "collapsed": true |
| 86 | + }, |
78 | 87 | "outputs": [],
|
79 | 88 | "source": [
|
80 | 89 | "countries = ['Croatia',\n",
|
|
109 | 118 | "cell_type": "markdown",
|
110 | 119 | "metadata": {},
|
111 | 120 | "source": [
|
112 |
| - "First, access the third to last element and set it equal to the variable `italy`." |
| 121 | + "First, access the third to last element from `countries` and set it equal to the variable `italy`." |
113 | 122 | ]
|
114 | 123 | },
|
115 | 124 | {
|
116 | 125 | "cell_type": "code",
|
117 |
| - "execution_count": 10, |
| 126 | + "execution_count": 5, |
118 | 127 | "metadata": {
|
119 | 128 | "collapsed": true
|
120 | 129 | },
|
121 | 130 | "outputs": [],
|
122 | 131 | "source": [
|
123 |
| - "italy = countries[-3] # 'Italy'" |
| 132 | + "italy = None # 'Italy'\n", |
| 133 | + "italy" |
| 134 | + ] |
| 135 | + }, |
| 136 | + { |
| 137 | + "cell_type": "markdown", |
| 138 | + "metadata": {}, |
| 139 | + "source": [ |
| 140 | + "> We assign the varible `italy` equal to `None`, but you should change the word `None` to code that uses the `countries` list to assign `italy` to `'Italy'`." |
124 | 141 | ]
|
125 | 142 | },
|
126 | 143 | {
|
127 | 144 | "cell_type": "code",
|
128 |
| - "execution_count": 11, |
129 |
| - "metadata": {}, |
130 |
| - "outputs": [ |
131 |
| - { |
132 |
| - "data": { |
133 |
| - "text/plain": [ |
134 |
| - "'Italy'" |
135 |
| - ] |
136 |
| - }, |
137 |
| - "execution_count": 11, |
138 |
| - "metadata": {}, |
139 |
| - "output_type": "execute_result" |
140 |
| - } |
141 |
| - ], |
| 145 | + "execution_count": 19, |
| 146 | + "metadata": {}, |
| 147 | + "outputs": [], |
142 | 148 | "source": [
|
143 | 149 | "italy # 'Italy'"
|
144 | 150 | ]
|
|
152 | 158 | },
|
153 | 159 | {
|
154 | 160 | "cell_type": "code",
|
155 |
| - "execution_count": 13, |
156 |
| - "metadata": {}, |
157 |
| - "outputs": [ |
158 |
| - { |
159 |
| - "data": { |
160 |
| - "text/plain": [ |
161 |
| - "'Mexico'" |
162 |
| - ] |
163 |
| - }, |
164 |
| - "execution_count": 13, |
165 |
| - "metadata": {}, |
166 |
| - "output_type": "execute_result" |
167 |
| - } |
168 |
| - ], |
169 |
| - "source": [ |
170 |
| - "mexico = countries[3]\n", |
171 |
| - "\n", |
| 161 | + "execution_count": 20, |
| 162 | + "metadata": {}, |
| 163 | + "outputs": [], |
| 164 | + "source": [ |
| 165 | + "mexico = None\n", |
172 | 166 | "mexico"
|
173 | 167 | ]
|
174 | 168 | },
|
|
181 | 175 | },
|
182 | 176 | {
|
183 | 177 | "cell_type": "code",
|
184 |
| - "execution_count": 16, |
185 |
| - "metadata": {}, |
186 |
| - "outputs": [ |
187 |
| - { |
188 |
| - "data": { |
189 |
| - "text/plain": [ |
190 |
| - "['USA', 'Argentina', 'Mexico', 'USA']" |
191 |
| - ] |
192 |
| - }, |
193 |
| - "execution_count": 16, |
194 |
| - "metadata": {}, |
195 |
| - "output_type": "execute_result" |
196 |
| - } |
197 |
| - ], |
198 |
| - "source": [ |
199 |
| - "kindof_neighbors = countries[1:5]\n", |
| 178 | + "execution_count": 21, |
| 179 | + "metadata": {}, |
| 180 | + "outputs": [], |
| 181 | + "source": [ |
| 182 | + "kindof_neighbors = None\n", |
200 | 183 | "kindof_neighbors"
|
201 | 184 | ]
|
202 | 185 | },
|
|
211 | 194 | "cell_type": "markdown",
|
212 | 195 | "metadata": {},
|
213 | 196 | "source": [
|
214 |
| - "Ok, now let's add a couple of countries onto this list. At the end of the list add the country 'Malta', followed by the country 'Thailand'." |
| 197 | + "Ok, now let's add a couple of countries onto this list. At the end of the list, add the country 'Malta'." |
215 | 198 | ]
|
216 | 199 | },
|
217 | 200 | {
|
218 | 201 | "cell_type": "code",
|
219 |
| - "execution_count": 18, |
220 |
| - "metadata": { |
221 |
| - "collapsed": true |
222 |
| - }, |
| 202 | + "execution_count": 24, |
| 203 | + "metadata": {}, |
223 | 204 | "outputs": [],
|
224 | 205 | "source": [
|
225 |
| - "countries.append('Malta')" |
| 206 | + "None # add code here" |
| 207 | + ] |
| 208 | + }, |
| 209 | + { |
| 210 | + "cell_type": "markdown", |
| 211 | + "metadata": {}, |
| 212 | + "source": [ |
| 213 | + "Then add the country 'Thailand'." |
226 | 214 | ]
|
227 | 215 | },
|
228 | 216 | {
|
229 | 217 | "cell_type": "code",
|
230 |
| - "execution_count": 19, |
231 |
| - "metadata": { |
232 |
| - "collapsed": true |
233 |
| - }, |
| 218 | + "execution_count": 25, |
| 219 | + "metadata": {}, |
234 | 220 | "outputs": [],
|
235 | 221 | "source": [
|
236 |
| - "countries.append('Thailand')" |
| 222 | + "None # add code here" |
| 223 | + ] |
| 224 | + }, |
| 225 | + { |
| 226 | + "cell_type": "markdown", |
| 227 | + "metadata": {}, |
| 228 | + "source": [ |
| 229 | + "Now your list of countries should look like the following." |
237 | 230 | ]
|
238 | 231 | },
|
239 | 232 | {
|
240 | 233 | "cell_type": "code",
|
241 |
| - "execution_count": 22, |
242 |
| - "metadata": {}, |
243 |
| - "outputs": [ |
244 |
| - { |
245 |
| - "data": { |
246 |
| - "text/plain": [ |
247 |
| - "['Croatia',\n", |
248 |
| - " 'USA',\n", |
249 |
| - " 'Argentina',\n", |
250 |
| - " 'Mexico',\n", |
251 |
| - " 'USA',\n", |
252 |
| - " 'Morocco',\n", |
253 |
| - " 'New Mexico',\n", |
254 |
| - " 'Finland',\n", |
255 |
| - " 'Argentina',\n", |
256 |
| - " 'Italy',\n", |
257 |
| - " 'Canada',\n", |
258 |
| - " 'South Korea',\n", |
259 |
| - " 'Malta',\n", |
260 |
| - " 'Thailand']" |
261 |
| - ] |
262 |
| - }, |
263 |
| - "execution_count": 22, |
264 |
| - "metadata": {}, |
265 |
| - "output_type": "execute_result" |
266 |
| - } |
267 |
| - ], |
| 234 | + "execution_count": null, |
| 235 | + "metadata": {}, |
| 236 | + "outputs": [], |
268 | 237 | "source": [
|
269 | 238 | "countries \n",
|
270 | 239 | "# ['Croatia', 'USA', 'Argentina', 'Mexico', 'USA', 'Morocco', 'New Mexico', 'Finland', \n",
|
|
275 | 244 | "cell_type": "markdown",
|
276 | 245 | "metadata": {},
|
277 | 246 | "source": [
|
278 |
| - "Now you may have notice that \"New Mexico\" is included in our list of countries. That doesn't seem right. Let's change 'New Mexico' to 'USA'." |
| 247 | + "You may have noticed that \"New Mexico\" is included in our list of countries. That doesn't seem right. Let's change 'New Mexico' to 'USA'." |
279 | 248 | ]
|
280 | 249 | },
|
281 | 250 | {
|
282 | 251 | "cell_type": "code",
|
283 |
| - "execution_count": 24, |
284 |
| - "metadata": { |
285 |
| - "collapsed": true |
286 |
| - }, |
| 252 | + "execution_count": 30, |
| 253 | + "metadata": {}, |
287 | 254 | "outputs": [],
|
288 | 255 | "source": [
|
289 |
| - "countries[6] = 'USA'" |
| 256 | + "None # add code here" |
290 | 257 | ]
|
291 | 258 | },
|
292 | 259 | {
|
293 | 260 | "cell_type": "code",
|
294 |
| - "execution_count": 26, |
295 |
| - "metadata": {}, |
296 |
| - "outputs": [ |
297 |
| - { |
298 |
| - "data": { |
299 |
| - "text/plain": [ |
300 |
| - "['Croatia',\n", |
301 |
| - " 'USA',\n", |
302 |
| - " 'Argentina',\n", |
303 |
| - " 'Mexico',\n", |
304 |
| - " 'USA',\n", |
305 |
| - " 'Morocco',\n", |
306 |
| - " 'USA',\n", |
307 |
| - " 'Finland',\n", |
308 |
| - " 'Argentina',\n", |
309 |
| - " 'Italy',\n", |
310 |
| - " 'Canada',\n", |
311 |
| - " 'South Korea',\n", |
312 |
| - " 'Malta',\n", |
313 |
| - " 'Thailand']" |
314 |
| - ] |
315 |
| - }, |
316 |
| - "execution_count": 26, |
317 |
| - "metadata": {}, |
318 |
| - "output_type": "execute_result" |
319 |
| - } |
320 |
| - ], |
| 261 | + "execution_count": null, |
| 262 | + "metadata": {}, |
| 263 | + "outputs": [], |
321 | 264 | "source": [
|
322 | 265 | "countries \n",
|
323 | 266 | "# ['Croatia', 'USA', 'Argentina', 'Mexico', 'USA', 'Morocco', 'USA', 'Finland', \n",
|
|
333 | 276 | },
|
334 | 277 | {
|
335 | 278 | "cell_type": "code",
|
336 |
| - "execution_count": 36, |
337 |
| - "metadata": {}, |
338 |
| - "outputs": [ |
339 |
| - { |
340 |
| - "data": { |
341 |
| - "text/plain": [ |
342 |
| - "'Thailand'" |
343 |
| - ] |
344 |
| - }, |
345 |
| - "execution_count": 36, |
346 |
| - "metadata": {}, |
347 |
| - "output_type": "execute_result" |
348 |
| - } |
349 |
| - ], |
| 279 | + "execution_count": null, |
| 280 | + "metadata": {}, |
| 281 | + "outputs": [], |
350 | 282 | "source": [
|
351 | 283 | "countries = ['Croatia',\n",
|
352 | 284 | " 'USA',\n",
|
|
362 | 294 | " 'South Korea', \n",
|
363 | 295 | " 'Malta', \n",
|
364 | 296 | " 'Thailand']\n",
|
365 |
| - "countries.pop() # 'Thailand'" |
| 297 | + "countries.pop() # 'Thailand'\n", |
| 298 | + "countries\n", |
| 299 | + "# ['Croatia', 'USA', 'Argentina', 'Mexico', 'USA', 'Morocco', 'USA', 'Finland', 'Argentina', 'Italy', 'Canada', 'South Korea', 'Malta']" |
366 | 300 | ]
|
367 | 301 | },
|
368 | 302 | {
|
|
388 | 322 | },
|
389 | 323 | {
|
390 | 324 | "cell_type": "code",
|
391 |
| - "execution_count": 37, |
| 325 | + "execution_count": 32, |
392 | 326 | "metadata": {
|
393 | 327 | "collapsed": true
|
394 | 328 | },
|
395 | 329 | "outputs": [],
|
396 | 330 | "source": [
|
397 |
| - "unique_countries = list(set(countries))" |
| 331 | + "unique_countries = None" |
398 | 332 | ]
|
399 | 333 | },
|
400 | 334 | {
|
401 | 335 | "cell_type": "code",
|
402 |
| - "execution_count": 38, |
403 |
| - "metadata": {}, |
404 |
| - "outputs": [ |
405 |
| - { |
406 |
| - "data": { |
407 |
| - "text/plain": [ |
408 |
| - "['USA',\n", |
409 |
| - " 'South Korea',\n", |
410 |
| - " 'Morocco',\n", |
411 |
| - " 'Finland',\n", |
412 |
| - " 'Italy',\n", |
413 |
| - " 'Mexico',\n", |
414 |
| - " 'Argentina',\n", |
415 |
| - " 'Malta',\n", |
416 |
| - " 'Croatia',\n", |
417 |
| - " 'Canada']" |
418 |
| - ] |
419 |
| - }, |
420 |
| - "execution_count": 38, |
421 |
| - "metadata": {}, |
422 |
| - "output_type": "execute_result" |
423 |
| - } |
424 |
| - ], |
| 336 | + "execution_count": 33, |
| 337 | + "metadata": {}, |
| 338 | + "outputs": [], |
425 | 339 | "source": [
|
426 | 340 | "unique_countries # ['USA', 'South Korea', 'Morocco', 'Finland', 'Italy', \n",
|
427 | 341 | "# 'Mexico', 'Argentina', 'Malta', 'Croatia', 'New Mexico', 'Canada']"
|
|
436 | 350 | },
|
437 | 351 | {
|
438 | 352 | "cell_type": "code",
|
439 |
| - "execution_count": 43, |
440 |
| - "metadata": {}, |
441 |
| - "outputs": [ |
442 |
| - { |
443 |
| - "data": { |
444 |
| - "text/plain": [ |
445 |
| - "3" |
446 |
| - ] |
447 |
| - }, |
448 |
| - "execution_count": 43, |
449 |
| - "metadata": {}, |
450 |
| - "output_type": "execute_result" |
451 |
| - } |
452 |
| - ], |
453 |
| - "source": [ |
454 |
| - "num_of_repeats = len(countries) - len(unique_countries) \n", |
| 353 | + "execution_count": 31, |
| 354 | + "metadata": {}, |
| 355 | + "outputs": [], |
| 356 | + "source": [ |
| 357 | + "num_of_repeats = None\n", |
455 | 358 | "num_of_repeats # 3"
|
456 | 359 | ]
|
457 | 360 | },
|
|
0 commit comments