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
Now write another function called `next_up` that returns our first destination (the destination with the lowest index), in the `travel_destinations` list.
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.
93
64
94
65
@@ -98,37 +69,20 @@ favorite_destination()
98
69
travel_destinations[-1] # 'madagascar'
99
70
```
100
71
101
-
102
-
103
-
104
-
'madagascar'
105
-
106
-
107
-
108
72
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.
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.
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