Review Python Tuples (Exercises)
00:00 Of course, we all know that just hearing about something doesn’t actually mean you know it. So here I’ve got a couple of review exercises for you to train the things you’ve learned about tuples before moving on to lists.
00:12 Feel free to do this at your own pace.
00:14
Create a tuple literal named location that holds the floating-point numbers 6.51 and 3.39, and then also the strings, "Lagos" and "Nigeria".
00:25 And they should be in that specific order.
00:28
Then use the index notation and the print() function to display the string at index two in location.
00:35
And finally, in a single line of code, you should unpack the values in location into four variables. Name them latitude, longitude, city, and country.
00:43
And then print each of these variables. We’ve got more for you. Use tuple() and a string literal to create a tuple called my_name that contains the letters of your name.
00:53
Then check whether the character "x" is in my_name using the in keyword. Finally, create a new tuple that contains all but the first letter of my_name and do that using slice notation.
01:07
So these are a few review exercises that can help you to fortify the information that you’ve learned about tuple. And when you’re done with them, you can move on to learning about lists.
Become a Member to join the conversation.

Dat Dinh on May 10, 2024
Could I get the solution of the Review Python Tuples (Exercises) lesson? Thanks