I don't really have a website to refer you to, but I can give a very simple example.
Here is some hard coded python code:
import arcpy
from arcpy import env
# Set hard coded workspace
env.workspace = "C:/data"
# Set hard coded copy inputs
arcpy.Copy_management("majorrds.shp", "C:/output/majorrdsCopy.shp", "")
arcpy.AddIndex_management("C:/output/majorrdsCopy.shp", "STREET_NAM", "StreetIndex", "UNIQUE", "ASCENDING")
With this code I have hard coded all inputs. To change the inputs I have to find every place I use a given value and replace it with a new input. So all of the paths have to be on any computer than runs this (both "C:/data" and "C:/output") and the new file I create "C:/output/majorrdsCopy.shp" has to be found and replaced twice. Also "majorrds.shp" has to contain a field named "STREET_NAM" in order for it to be in the output copy so I can index that field.
Below is the same code but it uses variables that will make it easier for me to change different parts of the inputs before I run the code by just changing the variable values. However, these variables are still based on hard coded values, because the actual string values are written in the code:
# Import system modules
import arcpy
from arcpy import env
# Set local variables
inwksp = "C/data"
outwksp = "C:/output"
in_data = "majorrds.shp"
out_data = "majorrdsCopy.shp"
out_data_full = outwksp + "//" + out_data
data_type = ""
field_name = "STREET_NAM"
index_name = "StreetIndex"
unique_option = "UNIQUE" # use "UNIQUE" or "NON_UNIQUE"
ascending_option = "ASCENDING" # use "ASCENDING" or "DESCENDING"
env.workspace = inwksp
arcpy.Copy_management(in_data, out_data_full, data_type)
arcpy.AddIndex_management(out_data_full, field_name, index_name, unique_option, ascending_option)
Every variable can have its values substituted with another string value at the top of the program without having to find where it is actually used in the code (finding all the lines of code that use a hard coded value can be much more difficult as the program gets longer). This makes it easier for me to test the code with different inputs during the testing phase.
Now here is the code where nothing is hard coded and it assumes there is a user input interface (like a tool) where the user chosses all of the variable inputs at run time:
# Import system modules
import arcpy
from arcpy import env
# Set run time variables
inwksp = arcpy.GetParameterAsText(0)
outwksp = arcpy.GetParameterAsText(1)
in_data = arcpy.GetParameterAsText(2)
out_data = arcpy.GetParameterAsText(3)
out_data_full = outwksp + "//" + out_data
data_type = ""
field_name = arcpy.GetParameterAsText(4)
index_name = arcpy.GetParameterAsText(5)
unique_option = arcpy.GetParameterAsText(6) # use "UNIQUE" or "NON_UNIQUE"
ascending_option = arcpy.GetParameterAsText(7) # use "ASCENDING" or "DESCENDING"
env.workspace = inwksp
arcpy.Copy_management(in_data, out_data_full, data_type)
arcpy.AddIndex_management(out_data_full, field_name, index_name, unique_option, ascending_option)
Unlike when I change the variables, because the user is providing every input I cannot be sure that every input makes sense. This program would require validation of the inputs in the tool set up by configuring the inputs to only accept certain values, setting up the Tool Validator to test for valid path and file name combinations and perhaps with validation steps set up as part of the code shown.