Find a Location (Exercise)
00:00
Let’s start with the first exercise. Find a location by creating a tuple literal named location
that holds two floating-point numbers, 6.51
and 3.39
, and then also the strings, "Lagos"
and "Nigeria"
.
00:15 And they should be in that order,
00:17
and then, use index notation to display the string at index two in location
. And finally, use one line of code to unpack the values in location
into four variables.
00:29
And name them latitude
, longitude
, city
, and country
. And then print each of them on a separate line.
00:36 That’s the task. You’re going to need to create a tuple, use indexing to access a value, and then also practice tuple unpacking. Give it a try and then move on to the next lesson where you can see me solve the exercise.
Become a Member to join the conversation.