So, i am tryinrg to solve this problem!
"You are given a feature class called parcels.shp that contains the following fields: FID, Shape, Landuse, and
Value. You need to write a script that determines the property tax and writes these values to the same feature
class in a new field called Tax."
i am stuck when it comes to adding and updating the Tax field. this is what i have so far. any hint would be very helpful. thanks
class parcel(object):
def __init__(self,landuse,value):
self.landuse = landuse
self.value = value
def assessment(self):
if self.landuse == "SFR":
rate = 0.05
elif self.landuse == "MFR":
rate = 0.04
else:
rate = 0.02
assessment = self.value*rate
return assessment
import arcpy
import parcelclass
arcpy.env.workspace = "C:/Lab8"
fc = "parcels.shp"
arcpy.AddField_management(fc, "Tax", "LONG", "", "", 10)
cursor = arcpy.da.UpdateCursor(fc, ["FID","Landuse","Value"])
for row in cursor:
myparcel = parcelclass.parcel(row[1],row[2],row[3])
mytax = myparcel.assessment()
cursor.updateRow(row)