Lists and Tuples in Python: Conclusion
In this course, you learned about working with lists and tuples. Lists and tuples are arguably Python’s most versatile, useful data types. You’ll find them in virtually every non-trivial Python program.
Here’s what you learned in this tutorial: You covered the important characteristics of lists and tuples. You learned how to define them and how to manipulate them. You now have a good feel for when and how to use these object types in a Python program.
Take the Quiz: Test your knowledge with our interactive “Lists vs Tuples in Python” quiz. You’ll receive a score upon completion to help you track your learning progress:
Interactive Quiz
Lists vs Tuples in PythonChallenge yourself with this quiz to evaluate and deepen your understanding of Python lists and tuples. You'll explore key concepts, such as how to create, access, and manipulate these data types, while also learning best practices for using them efficiently in your code.
Congratulations, you made it to the end of the course! What’s your #1 takeaway or favorite thing you learned? How are you going to put your newfound skills to use? Leave a comment in the discussion section and let us know.
00:00 Hey, congratulations! You’ve completed the course. This video is a conclusion and course review. You started with an intro and a course overview. In the second video, you saw how lists are ordered and can contain arbitrary objects.
00:21 Next, you started to learn indexing syntax and how to do slicing, along with strides. After that, you practiced using operators on lists. And then how to use some of the built-in Python functions on your lists.
00:40 Then you learned about how lists can be nested, and not only contain sublists, but those sublists can have sublists inside of them. And then, because lists are mutable and dynamic, you learned ways to change the lists, and grow and shrink them.
00:58 Then it was a deep dive into list methods and how to use those methods to modify your list in place.
01:10 But there are a few additional list methods that you learned about that actually had return values and behave a little differently. And then it was time to talk about using tuples and how to define them, and how they’re different from lists.
01:30 You learned about how to do tuple packing and unpacking. And of course, this conclusion and course review. Thank you for checking out this course on Real Python, and make sure you take some time to practice what you’ve learned here.
Pygator on Sept. 29, 2019
Really like your presentation style, favorite presenter for sure. Thanks again!
Cyntia Goulart on Oct. 27, 2019
OMG! I thought I knew Python well and you proved me wrong. Know what it is is totally different of knowing how to use it. I am so glad I took this course. Thank you! Thank you! Greetings from Brazil! :D
Levi on March 13, 2020
Thought I had a good handle on tuples and lists, but I learned probably twice as much as I knew before. Super in-depth, great course.
Sandro on March 16, 2020
Mmmm… baaacon. Mmm.
Thanks for the interesting piece about tuples being faster than lists. So in for-loops, if we iterate through a list that we know should not be changing, then tuples are the way to go.
wayne2056 on March 26, 2020
I’m trying to teach this old dog new tricks… spent some time searching for how the heck do I make an array in python ( old habits )… duh it’s a list. Very cool
pshapard on March 29, 2020
So much here to take in. Lots to know and remember. Need to look over the slicing and indexing functions. Thanks for the course and great instructor
Cristian Palau on April 15, 2020
Thank you for this great course!
birajksahu on June 21, 2020
Loved it! I can easily say I have scaled myself up on this topic. Just one suggestion- can we include some more practice programs- Q&A
Ben Nduwuba on June 24, 2020
Fantastic !! Well done Chris
Alain Rouleau on Aug. 2, 2020
Thanks, really enjoyed the course. All very interesting.
My favourite list method by far is the pop()
method. It’s extremely powerful yet so easy to use. I put together some sample code to illustrate how you can pop()
not just strings, integers, etc. But your own objects as well.
For people not familiar with Object-Oriented Programming (OOP) don’t worry. Instead of a string object being popped it’s an airplane object. Each airport has a variable called ‘tarmac’ which is just a list to hold the airplane. So, to fly the airplane from London to New York I just pop()
it from one list to another list. How crazy is that!
>>> class Airplane: pass
>>> class Airport:
... def __init__(self):
... self.tarmac = [] # List to hold the airplane
>>> boeing_747 = Airplane()
>>> london_heathrow = Airport()
>>> new_york_jfk = Airport()
>>> boeing_747
<__main__.Airplane at 0x1f4e3439d90>
>>> london_heathrow
<__main__.Airport at 0x1f4e3439d00>
>>> new_york_jfk
<__main__.Airport at 0x1f4e3447f40>
>>> print(london_heathrow.tarmac, new_york_jfk.tarmac)
[] [] # Two empty tarmacs
>>> london_heathrow.tarmac.append(boeing_747) # Move plane to London tarmac
>>> print(london_heathrow.tarmac, new_york_jfk.tarmac)
[<__main__.Airplane object at 0x000001F4E3439D90>] [] # Plane in London
>>> new_york_jfk.tarmac.append(london_heathrow.tarmac.pop()) # Fly to NY
>>> print(london_heathrow.tarmac, new_york_jfk.tarmac)
[] [<__main__.Airplane object at 0x000001F4E3439D90>] # Plane now in NY
Now think of what you could do with a deck of cards, popping each card off the top of the deck. Or moving cars from one parking lot to another. It’s crazy. You can have so much fun with the pop()
method, LOL
cherianzachariah on Aug. 5, 2020
There is a lot of new little things that I learnt from this course. Thank you and keep up the good work. I am loving it so far.
Ghani on Oct. 20, 2020
Very good course; thank you so much!
Rupesh Kolatwar on Jan. 24, 2022
Thank You So much!!! feeling a bit confident now about the list. can you please share any project for practice ?
rwelk on Feb. 3, 2024
Very Interesting course it’s got me looking over scripts I have written in the past to see what kind of improvements I can make to them. Great presentation! Thank you
Become a Member to join the conversation.
slickrick on Sept. 4, 2019
Fantastic! This really helped me level up my understanding of lists and tuples. Keep up the great work!