 This video explains the solution to the lesson 2 practice exercise in which we clip a bunch of feature classes from the USA Geo database to the Iowa State boundary. In line 3 we import the ArcPy side package This is required whenever we work with Esri tools or data sets In line 6, 7, and 8 we set up a series of string variables Representing the locations on disk that we will work with during this script Now if you were going to go ahead and make a script tool out of this You would eventually want to change these to ArcPy.getParameter as text, as described in the lesson text However, while you're working on your script in Python when you'll want to actually write out the full path So you can test and make sure that your script works Once you're absolutely certain that your script works Then you can go ahead and insert ArcPy.getParameter as text And then you can start making the script tool and test out the tool So I recommend you keep those two parts separate, testing in Python when first And then making the tool In line 6 and 7 we set up the path to some of the Geo databases we'll be working with Line 6 is the USA Geo database that contains the feature classes that we will clip In line 7 is the Iowa Geo database where we will put the output feature classes And line 8 is the actual clip feature. This is our cookie cutter feature That is the state boundary of Iowa Now we've used the term workspace in the line 6 and 7 variable names Just to mean a folder or a Geo database in which we're working But there is an official workspace for ArcPy which is the current folder or Geo database in which ArcPy is looking for items And so in line 11 we actually set the ArcPy workspace to be the same path that we set up in line 6 Which is USA And when we start listing feature classes that's going to be the workspace that we look in Line 12 is where we call the method to list feature classes And the question is list feature classes where? And the answer is the workspace that we just set up in line 11 So it's going to default to look in ArcPy's workspace for the feature classes it should list And so what we get out of this is a variable that we call feature class list And it is a Python list of all the feature classes in the USA Geo database And this is great now because we know how to loop through a list And we're going to do that here in just a minute In line 14 we begin to try block So we'll try to run all this code from line 14 to 25 If for some reason there's a crash The code will go down to line 27 and run the accept block In line 17 we begin a for loop to try to go through each feature class in the list And we create a new variable in line 17 called feature class So we say for feature class in feature class list Feature class is just a name that we come up with for that variable We could name it anything in this case it's pretty intuitive to call it feature class Line 20 is setting up the output path Now one of our requirements was to append Iowa at the beginning of the output feature class name And so we're doing a little bit of string manipulation using the plus sign to make a path This particular string output feature class is going to be created by concatenating the target workspace So that's what you created up in line 7 So that will always be part of the output path Then we're going to explicitly add slash Iowa And then onto that we'll tack the name of the feature class that we're currently working with And this type of string concatenation to make a path is something that you'll also need to do during your lesson 2 project In line 23 we actually perform the clip by calling archpia.clip And we need to put underscore analysis because we want to specify that we're using the clip tool that's in the analysis toolbox Now clip in this case has three required parameters The input feature class to be clipped So that's the current one that we're looping on right now It was defined up in line 17 So that's the first parameter, feature class The second parameter there is the clip feature And we defined that up in line 8 That's our cookie cutter feature We'll be clipping all the rest of the feature classes too And then the third is the output path And that's the path we just created back in line 20 And once we have all three of those things we can run the clip tool In lines 24 and 25 we report what happened And we use a little bit of string concatenation there as well to make a custom message Saying exactly the path of the clipped file that we created And this will be useful in your project as well Now this is an either or scenario you would need to call either add message or do a print statement in line 25 I just put both of them in here so you can see how they were both used If you're going to go ahead and make a script tool out of this That would go in your toolbox in ArcGIS Then you would use the approach in line 24, add message If you're just going to run this inside of Python when then you would use line 25 If for some reason there were to be a crash in the above code It would jump down to line 27 and run the accept statement And again we're using the approach of doing either an add error This is what you would use if you were making a toolbox So that's line 30 Or if you're just running in Python when you could do line 31 And then line 32 is another print statement you could do out of Python when It actually gets the message from the clip tool The Esri geoprocessing tools report their own error messages So if you were to have a problem that happened inside the clip You might be able to get it back this way by doing printarchpy.getmessages