In our programs we often work with collections of data. For example, we may work with student grades, or with the titles of books. In this lecture I will introduce you to the Python list type. And we will explore some of the functions and operations, that can be applied to lists. To begin, I'm going to create a variable grades that refers to a three element list of integers. The notation for our list, is an opening square bracket, comma separated values, and a closing square bracket. Grades is a three element list, or we say that grades has three items. The first item is at index zero. And grades at index zero refers to the int 80. Grades at 1 refers to int 90, and grades at index 2 refers to int 70. We can also take slices of a list like we can with a string. Beginning with a start index, in this case I'll start at index 1, and an ending index going up to 2. This gives me a slice of the list, which contains a single int, 90. I go from grades at 0, up to 2, then a 2 element slice is given with 80 and 90. So the same rules for slicing apply to lists as for strings. The in operator that we used for strings, can also be used with lists. So this asks whether 80 is an element of the list grades, which it is. The expression 60 in grades, evaluates to false since 60 is not an element of the list grades. Some of Python's built in functions that we used earlier with other types, can also be applied to type list. For example, we can find the length of a list, in this case 3, because the list has three elements. We can also find the smallest value in a list, by passing the list as an argument to the function min. And when we call the function max on a list, it returns the largest element. There's another function called sum, that will sum the elements of the list. So this case it sums 80, 90 and 70, returning 240. Grades is a list of ints, but we can have lists of other types as well. This subjects variable will refer to a list of strings. Some of the same functions that we applied to the list of ints, can also be applied to the list of strings. For example we can find out its length, and we can find out the minimum value in the list. For strings, dictionary ordering is what is compared. And the minimum in this case is bio, the max is going to be that comes latest in the alphabet, or latest in the dictionary, which is math. And the sum function can not be applied to strings. A type error occurs when someone's applied to the list of strings. Data of different types may be contained in the same list. For example, let's make a street_address list. It will have an int for the street number, and a string for the name of the street. So we've got an int and a string in the same list. The final thing to show you in this introduction to lists, is the for loop over lists. So let's look at our grade example. So each grade in the grade's list, we will loop over it and display it. Grade is a variable name. I could have used something like item or element here. So we'll print those three grades. Similarly, we might loop over subjects, and I'm changing the variable name just to emphasize that that is just a variable, referring to each element of the list in turn, starting from index zero, working to the end of the list, printing the subjects.