Skip to content

Commit 948543e

Browse files
committed
removing jupyter notebook tests
1 parent f552383 commit 948543e

File tree

2 files changed

+21
-226
lines changed

2 files changed

+21
-226
lines changed

README.md

Lines changed: 2 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ top_travel_cities = ['Solta', 'Greenville', 'Buenos Aires', 'Los Cabos', 'Walla
2222

2323
> Remember to press shift+enter to run each gray block of code (including the one above). Otherwise, the variables will not be defined.
2424
25+
In this lesson we will work with a list of associated countries corresponding to each of the top travel cities.
26+
2527

2628
```python
2729
countries = ['Croatia',
@@ -44,24 +46,6 @@ Ok, so the list of countries associated with each city has been assigned to the
4446

4547
### Accessing elements from lists
4648

47-
For the tests in this lab to work, please run the following two cells.
48-
49-
50-
```python
51-
!pip install ipython_unittest
52-
```
53-
54-
Collecting ipython_unittest
55-
Downloading ipython_unittest-0.3.1-py2.py3-none-any.whl
56-
Installing collected packages: ipython-unittest
57-
Successfully installed ipython-unittest-0.3.1
58-
59-
60-
61-
```python
62-
%load_ext ipython_unittest
63-
```
64-
6549
First, set the variable `italy` to be equal to the third to last element from `countries`.
6650
>**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.
6751
@@ -78,14 +62,6 @@ italy
7862
italy # 'Italy'
7963
```
8064

81-
82-
```python
83-
%%unittest_testcase
84-
85-
def test_italy(self):
86-
self.assertEqual(italy, 'Italy')
87-
```
88-
8965
Now access the fourth element and set it equal to the variable `mexico`.
9066

9167

@@ -94,14 +70,6 @@ mexico = None
9470
mexico
9571
```
9672

97-
98-
```python
99-
%%unittest_testcase
100-
101-
def test_mexico(self):
102-
self.assertEqual(mexico, 'Mexico')
103-
```
104-
10573
Notice that the second through fifth elements are all in a row and all in the Western Hemisphere. Assign that subset of elements to a variable called `kindof_neighbors`.
10674

10775

@@ -110,14 +78,6 @@ kindof_neighbors = None
11078
kindof_neighbors
11179
```
11280

113-
114-
```python
115-
%%unittest_testcase
116-
117-
def test_kindof_neighbors(self):
118-
self.assertEqual(kindof_neighbors, ['USA', 'Argentina', 'Mexico', 'USA'])
119-
```
120-
12181
### Changing Elements
12282

12383
Ok, now let's add a couple of countries onto this list. At the end of the list, add the country 'Malta'.
@@ -143,14 +103,6 @@ countries
143103
# 'Argentina', 'Italy', 'Canada', 'South Korea', 'Malta', 'Thailand']
144104
```
145105

146-
147-
```python
148-
%%unittest_testcase
149-
150-
def test_countries(self):
151-
self.assertItemsEqual(countries, ['Croatia', 'USA', 'Argentina', 'Mexico', 'USA', 'Morocco', 'New Mexico', 'Finland', 'Argentina', 'Italy', 'Canada', 'South Korea', 'Malta', 'Thailand'])
152-
```
153-
154106
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'.
155107

156108

@@ -165,14 +117,6 @@ countries
165117
# 'Argentina', 'Italy', 'Canada', 'South Korea', 'Malta', 'Thailand']
166118
```
167119

168-
169-
```python
170-
%%unittest_testcase
171-
172-
def test_countries_with_usa(self):
173-
self.assertNotIn('New Mexico', countries)
174-
```
175-
176120
Finally, let's remove Thailand from the list. No good reason, we're acting on whimsy.
177121

178122

@@ -215,14 +159,6 @@ countries
215159

216160

217161

218-
219-
```python
220-
%%unittest_testcase
221-
222-
def test_countries_with_usa(self):
223-
self.assertNotIn('Thailand', countries)
224-
```
225-
226162
### Exploring Lists with Methods
227163

228164
Ok, now we notice that some countries are mentioned more than once. Let's see how many repeat countries are on this list.
@@ -240,14 +176,6 @@ unique_countries # ['Canada', 'Italy', 'USA', 'Mexico', 'Finland',
240176
#'Malta', 'Morocco', 'Croatia', 'Argentina', 'South Korea']
241177
```
242178

243-
244-
```python
245-
%%unittest_testcase
246-
247-
def test_unique_countries(self):
248-
self.assertItemsEqual(unique_countries, ['USA', 'South Korea', 'Morocco', 'Finland', 'Italy', 'Mexico', 'Argentina', 'Malta', 'Croatia', 'Canada'])
249-
```
250-
251179
Now the number of repeat countries should be the number of countries minus the number of unique countries. So use the `len` function on both `unique_countries` and `countries` to calculate this and assign the result to the variable `num_of_repeats`.
252180

253181

@@ -256,14 +184,6 @@ num_of_repeats = None
256184
num_of_repeats # 3
257185
```
258186

259-
260-
```python
261-
%%unittest_testcase
262-
263-
def test_num_of_repeats(self):
264-
self.assertEqual(num_of_repeats, 3)
265-
```
266-
267187
### Summary
268188

269189
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.

0 commit comments

Comments
 (0)