 In this video, I'll be explaining one solution to Lesson 3, Practice Exercise D, in which we need to select park and ride facilities in a given target city and export them to a new feature class. This solution will have a lot of elements that were used in exercises B and C. The patterns should start to look familiar to you. In Line 4, we import the ArcPy site package, and then in Line 5, I set up a variable to represent the city on which I want a query for the park and rides. I'm going to be doing an attribute query for the city, and then I'm going to follow it up with a spatial query to just get the park and rides that fall within that selected city. And putting Line 5 at the top like this allows me to change the city easily so I can test it with different values without having to hunt through my code. In Line 6, I set up the workspace, which is my file geodatabase. This was a technique that I also used in exercises C, exercise C solution, which is convenient because I'll be working with several feature classes here. In lines 7 and 8, I decided to set up some variables to store the names of those feature classes. That's not really necessary. I could just plug in those names into the functions in lines 14 and 15. But sometimes, when I'm working with a lot of data sets, I like to set up everything at the beginning just so I can see exactly what I'm working with easily. The rest of the code, some of it could go within try, accept, and finally blocks. For simplicity, I've left those out here, although for code quality, we're asking you to include those in appropriate places in your project submissions. What I'll do first here is on line 11, set up the SQL query string to get just the city of Federal Way on its own. I'm doing this attribute query here, similar to what we did in exercise B. I'm querying on the name field for the city. The expression as a whole, being a string, needs to be in quotes. I use string gotNation to plug the name of the target city inside single quotes. Once I have my query string, on line 14, I can make it a feature layer of just that target city. By now, this pattern of making a feature layer, passing in the parameter should be pretty familiar to you. First parameter is the name of the feature class that I'm using. Remember in line 8, I set up a variable for that. The second parameter is the name that I want to give this feature layer throughout the script. I'm going to call it city's layer. The third parameter is the optional SQL query expression that's going to narrow down the cities to, in this case, just the city of Federal Way. In line 15, I'm making a feature layer of all the bark and ride facilities. In this line, I pass only two parameters because I want all of them. I'm not going to pass any type of query string here. So the two parameters are the variable that I set up in line 7, referring to the bark and ride feature class, and then the name that I want to give to the feature layer in the script, I called it bark and ride layer. With all of those elements, I can now do a select layer by location statement so that I can get just the bark and rides that fall within that selected city. So I pass in the bark and ride layer and the type of spatial relationship, which I'm using, which is contained by, which we've seen in the previous exercises. And then it's the city's layer that I want to use to do the selection. So that's the third parameter. Once I have the selection made, then I can copy those selected features into a new feature class. And just like you saw in practice exercise C, I'm using the copy features tool, and I specify my park and ride layer feature layer as the source of the features that I want to copy. Then the second parameter is the name of the new feature class that will be created. It's going to go into that workspace that we set up on line 6, the file geodatabase. And I'm going to call the feature class target park and ride facilities. Then at the end of your code, preferably within a finally block, but somewhere at the end, you're going to delete the feature layers to clean them up and remove locks on the underlying data. In this case, we have two feature layers to clean up. And that's all it takes to complete this exercise.