Welcome back. So were strings like S are sequences of characters,
lists are a new kind of Python type which are sequences of any type of value,
which can include other strings or lists.
So lists are created by using square brackets.
I start creating a list by using a left square bracket,
and then I put my contents separated by commas.
Here I'll make the first item actually be a string.
I'll make the second item be an integer,
and I'll make the third item be another string.
When I print out my list,
then I get back the items that I actually put into the list.
Now just like strings,
lists have an order and a length.
In the case of this list my list,
then I actually have three items.
The first item is the string one,
and then separating out every item is a comma.
The second item is the integer two,
separated by a comma again,
and the third item is the string three.
I would say that this list has length three.
The first item being one,
the second item being the integer two,
the third item being the string three.
Here are a few other examples of lists.
Just like I can have an empty string,
I can also have an empty list.
This is a list with link zero.
I can also have a list with one item.
Here my list is a list with one item,
and that one item is the integer 100.
Now just like strings,
this my list equals the list 100 is very
different from creating an integer I equal to 100.
Even though these looks similar us,
to Python these are entirely different.
Further, if I make S the string 100,
then all three of these are entirely different things,
because S is a string,
my list is the list,
and I is an integer.
If I tried to do something like my list plus five,
then I would get a run time error
saying that we can only concatenate lists with other lists,
because my list is a list,
the only other thing that we can add to it is a list,
as we'll talk about it in a later lesson. Until next time.