This course will be retired on January 6, 2020.
Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
Let's Review Lists1:37 with Kenneth Love
Lists are probably the one single data type you'll use more than any other.
I'm sure you remember, but just to refresh:
- Lists are mutable, which means they can be changed in place
- Lists have an order, something comes first, second, etc
- List items can be accessed by their index using bracket notation
- You can make a list with
literals or by using the
Hi I'm Kenneth, a Python teacher here at Treehouse.
In Python basics I showed you, well, the basics of Python.
We learned about a few basic types of data- numbers, strings, lists, and
We also use some basic programming logic like conditionals and loops.
In this course though,
we're not gonna focus so much on basic building blocks like true and false.
And we're not gonna spend a lot of time on loops, either.
Instead, we're going to take a bit deeper look into a huge section of Python
known as containers or collections.
You've already learned about two types of collections actually, lists and strings.
A list, if you remember, is a collection of things in a certain order.
Each item has an index which says, where it is in the chain of the collection.
The first items index is zero, the next is that one, and so on.
Strings work pretty much the same way.
The first character in the string is that index zero, the next is that one, etc.
Both of these collections and all of the others that we'll talk about later
are Iterable, which means that we can loop through them with for loops.
Strings and lists have one very important difference.
Strings are immutable which means that we're not allowed to change them in place.
If I have the string apple and
I change the first letter to be an O, it's no longer the same string.
So it has to take up a new spot in memory.
With a list though, I'm allowed to change any or all of the items in the list
without assigning it to a new variable, and giving it to a new location in memory.
Since lists are mutable, they have a lot more bits and
pieces to understand than strings do.
I think lists are a good place to start this course then,
since they're are a great introduction to a lot of the other types we'll cover
in this course.
Let's start the next video off, by talking about how to make our lists bigger.
You need to sign up for Treehouse in order to download course files.Sign up