Skip to content

Done #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@

# Lists Lab
# Lists Lab

### Introduction

Ok, so now that we have a sense of how to read and alter a list in Python, let's put this knowledge to use.
Ok, so now that we have a sense of how to read and alter a list in Python, let's put this knowledge to use.

### Objectives

* Practice reading one and multiple elements from lists
* Practice altering data in lists
* Practice adding elements and removing elements from lists

### Our initial data structure
### Our initial data structure

In the previous lesson, we had a list of top travel cities.

Expand Down Expand Up @@ -98,8 +98,8 @@ Now your list of countries should look like the following.


```python
countries
# ['Croatia', 'USA', 'Argentina', 'Mexico', 'USA', 'Morocco', 'New Mexico', 'Finland',
countries
# ['Croatia', 'USA', 'Argentina', 'Mexico', 'USA', 'Morocco', 'New Mexico', 'Finland',
# 'Argentina', 'Italy', 'Canada', 'South Korea', 'Malta', 'Thailand']
```

Expand All @@ -112,8 +112,8 @@ countries = None # add code here


```python
countries
# ['Croatia', 'USA', 'Argentina', 'Mexico', 'USA', 'Morocco', 'USA', 'Finland',
countries
# ['Croatia', 'USA', 'Argentina', 'Mexico', 'USA', 'Morocco', 'USA', 'Finland',
# 'Argentina', 'Italy', 'Canada', 'South Korea', 'Malta', 'Thailand']
```

Expand All @@ -132,8 +132,8 @@ countries = ['Croatia',
'Argentina',
'Italy',
'Canada',
'South Korea',
'Malta',
'South Korea',
'Malta',
'Thailand']
countries.pop() # 'Thailand'
countries
Expand All @@ -149,11 +149,14 @@ First, use the `set` and `list` functions to return a unique list of countries.

```python
unique_countries = None
type(set())
unqiue_countries_set = set(countries)
unique_countries = list(unqiue_countries_set)
```


```python
unique_countries # ['Croatia', 'Argentina', 'Canada', 'Mexico', 'Italy',
unique_countries # ['Croatia', 'Argentina', 'Canada', 'Mexico', 'Italy',
#'South Korea', 'USA', 'Morocco', 'Malta', 'Finland'] Note: order of countries may be different
```

Expand Down