Skip to content

Commit 2645538

Browse files
committed
updating readme
1 parent cb7b509 commit 2645538

File tree

1 file changed

+4
-57
lines changed

1 file changed

+4
-57
lines changed

README.md

Lines changed: 4 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,20 @@ Imagine we are working on our list of travel destinations -- which is really tur
1818
```python
1919
travel_destinations = ['argentina', 'mexico', 'italy', 'finland', 'canada', 'croatia']
2020
def number_of_destinations():
21-
return len(travel_destinations)
21+
pass
2222
```
2323

2424

2525
```python
2626
number_of_destinations() # 6
2727
```
2828

29-
30-
31-
32-
6
33-
34-
35-
3629
Now write another function called `next_up` that returns our first destination (the destination with the lowest index), in the `travel_destinations` list.
3730

3831

3932
```python
4033
def next_up():
41-
return travel_destinations[0]
34+
pass
4235
```
4336

4437

@@ -48,47 +41,25 @@ next_up() # 'argentina'
4841
```
4942

5043

51-
52-
53-
'argentina'
54-
55-
56-
57-
5844
```python
5945
travel_destinations = ['finland', 'canada', 'croatia']
6046
next_up() # 'finland'
6147
```
6248

63-
64-
65-
66-
'finland'
67-
68-
69-
7049
Ok, now write a function called `favorite_destination` that returns the string `'madagascar'`.
7150

7251

7352
```python
7453
travel_destinations = ['argentina', 'mexico', 'italy', 'finland', 'canada', 'croatia']
7554
def favorite_destination():
76-
travel_destinations.append('madagascar')
77-
return travel_destinations[-1]
55+
pass
7856
```
7957

8058

8159
```python
8260
favorite_destination() # 'madagascar'
8361
```
8462

85-
86-
87-
88-
'madagascar'
89-
90-
91-
9263
Again, let's declare an array called `travel_destinations`. Change the function `favorite_destination` so that it continues to return the string `'madagascar'`, but also adds the string `'madagascar'` to the end of the list of destinations.
9364

9465

@@ -98,37 +69,20 @@ favorite_destination()
9869
travel_destinations[-1] # 'madagascar'
9970
```
10071

101-
102-
103-
104-
'madagascar'
105-
106-
107-
10872
Now let's write another function which iterates through the list of `destinations` and capitalizes the first letter of each word. It should return a list of capitalized destinations.
10973

11074

11175
```python
11276
travel_destinations = ['argentina', 'mexico', 'italy', 'finland', 'canada', 'croatia']
11377
def capitalize_countries():
114-
capitalized_countries = []
115-
for destination in travel_destinations:
116-
capitalized_countries.append(destination.title())
117-
return capitalized_countries
78+
pass
11879
```
11980

12081

12182
```python
12283
capitalize_countries() # ['Argentina', 'Mexico', 'Italy', 'Finland', 'Canada', 'Croatia']
12384
```
12485

125-
126-
127-
128-
['Argentina', 'Mexico', 'Italy', 'Finland', 'Canada', 'Croatia']
129-
130-
131-
13286
Great! Now if someone adds a country that is lowercased to our list of destinations, we can simply call our function again to capitalize each of the destinations in the list.
13387

13488

@@ -139,13 +93,6 @@ travel_destinations.append('japan')
13993
capitalize_countries() # ['Argentina', 'Mexico', 'Italy', 'Finland', 'Canada', 'Croatia', 'Japan']
14094
```
14195

142-
143-
144-
145-
['Argentina', 'Mexico', 'Italy', 'Finland', 'Canada', 'Croatia', 'Japan']
146-
147-
148-
14996
## Summary
15097

15198
Great job! In this lab we were able to get practice both writing and returning values from functions. We also practiced accessing variables not local to the function but in the global scope.

0 commit comments

Comments
 (0)