You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> Remember to press shiftenter to run each gray block of code.
23
+
> Remember to press shift+enter to run each gray block of code (including the one above). Otherwise, the variables will not be defined.
24
24
25
-
In this lesson we can work with a list of each associated countries for each of those travel cities.
25
+
In this lesson we can work with a list of associated countries corresponding to each of the top travel cities.
26
26
27
27
28
28
```python
@@ -40,19 +40,22 @@ countries = ['Croatia',
40
40
'South Korea']
41
41
```
42
42
43
+
> Run the code in the cell above by pressing shift + enter.
44
+
43
45
Ok, so the list of countries associated with each city has been assigned to the variable `countries`. Now we will work with reading and manipulating this list.
44
46
45
47
### Accessing elements from lists
46
48
47
-
First, access the third to last element from `countries` and set it equal to the variable `italy`.
49
+
First, set the variable `italy` to be equal to the third to last element from `countries`.
50
+
>**Note:** If you see an **error** stating that `countries` is undefined, it means you must press shift+enter in the second gray box where `countries` variable is assigned.
48
51
49
52
50
53
```python
51
54
italy =None# 'Italy'
52
55
italy
53
56
```
54
57
55
-
> 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'`.
58
+
> We assign the variable`italy` equal to `None`, but you should change the word `None` to code that uses the `countries` list to assign `italy` to`'Italy'`. We wrote the variable `italy` a second time, so that you can see what it equals when you run the code block. Currently, nothing is displayed below as it equals `None`, but when it's correct it will match the string which is commented out,`'Italy'`.
In this section we saw how to get our data from the outside world and into Python. The purpose isn't to understand all of this code right now, but rather to see how easily we can start working with outside data. As we become better at Python, the usefulness of taking data and operating on it in code rather than a spreadsheet will become more apparent. But that doesn't mean we can't get step outside of Python sandbox now. It's not too difficult to take some data we may already have, and begin to use it with Python. In the next section, we'll use a lab to get data from excel and work with lists.
171
+
In this lesson, we practiced working with lists in Python. We saw how to add and remove elements from a list, as well as select specific elements. Finally, we saw how to use a different data structure to calculate the number unique elements in the list.
"In this lesson, we had some practice with working with lists in Python. We saw how to add and remove elements from a list, as well as select specific elements. Finally, we saw how to use a different data structure to calculate the number unique elements in the list."
405
+
"In this lesson, we practiced working with lists in Python. We saw how to add and remove elements from a list, as well as select specific elements. Finally, we saw how to use a different data structure to calculate the number unique elements in the list."
0 commit comments