 This video walks through the solution to lesson 4, practice exercise A, wherein you have a text file with some coordinates that looks like this, and you need to loop through those and parse them out and then create a polygon out of it to create the shape of a U.S. state. Notice that the first coordinate in this list and the last one are the same, indicating that it will be a polygon. This is a pretty basic list. There's no header here, so we're just going to blast right through this as if it were a CSV file with two columns and no header. In order to do this, we're going to use ArcPy, which we import in line 3, and the CSV module for Python, which we import in line 4. We're also in line 6 and 7. We set up some variables referencing the files that we're going to work with in this script. So we're working with the mystery state shape file that was provided for you. This shape file has a coordinate system. I believe it's WGS84 geographic coordinates. However, there is no shape or polygon within this shape file yet. You will add that. And then line 7 references the path to the text file containing all those coordinate points. In line 8, we do a little bit of work to detect the spatial reference of that mystery state shape file. We'll use that later when we start creating geometries. This pattern of using the describe method and then getting the spatial reference property should be familiar to you from your work in lesson 2. In line 11, we open up that text file that has the points. So the first parameter, but the open method is point file path, which we created in line 7. And then the second parameter is R in quotes. That means we're opening it in read mode. We're just going to read this file. We're not going to write anything into it. And in line 12, we then pass that file in to the CSV reader constructor so that we can create this CSV reader object that will allow us to iterate through all the rows in the file in an easy fashion. Before we start doing that, though, in line 16, we create an empty ArcPy array object. We know in this case, we're just going to create one geometry. It's going to be one polygon with one array. So it's okay to create that array before we start looping. And we actually don't want to create it inside the loop because we would be creating multiple arrays and we just need one of them in this case. In line 19, we actually started looping through the rows in the file. Each row is going to be represented here by a variable called chords. And so in line 22, we create an ArcPy point object. And when you create a point, you need at least the longitude coordinate, which is the x value and the latitude, which is the y. Now, going back to our file, you'll see that in the first column or column zero, that's the longitude. So we have chords zero in our code. And then the next piece is the latitude or the y coordinate. And that's in column with index one. So we use chords one for the y. Once we have that point, we can add it into the array. We just keep doing that, cycling through the file until we've added point after point after point inside that array. And we've gotten to the end. Now, in line 28, the loop has exited. Notice that because it's not indented. And we're going to take the array that we made and make a polygon object out of it. So we create ArcPy dot polygon. And the things we pass in are the array itself and then the spatial reference for this geometry, which we retrieved back in line eight. So we've got the polygon all set up, but we haven't added it to the shape file yet. And in order to do that, we're going to use an insert cursor. In this case, we just use the very simple width statement to create the insert cursor. The insert cursor needs a couple of parameters in order to get started. It needs the path to the file that we're going to modify. And that's represented by the variable shape file. Remember, we created that back in line six. And then there's this tuple of fields that we're going to modify. In our case, we're only going to modify the geometry. We're not going to modify any attributes. So the way that we supply this tuple is it just has one item called shape with the at sign and then a comma. A tuple of one just ends with a comma like this inside the parentheses. And then our final line 32 actually inserts the row. And it inserts just the polygon geometry and nothing else as described. When this is done, we should be able to go into ArcMap and verify that we indeed have a polygon inside of that shape file.