I'm working on a script that will use a predefined list of strings to calculate the value of a new field. The idea is this: if the value of field 'EF_Type' is equal to the value of a string in the field 'Schools', then the new field 'EF_Group' will be calculated to equal 'Schools.'
School = ['CollegesUniversities', 'PrivateSchools', 'PublicSchools', 'SupplementalColleges'] EmergencyServices = ['EMS_Stations', 'Hospitals', 'UrgentCare', 'RedCross'] for Sublist in [PointsInt, LinesInt]: for fc in Sublist: fcname = os.path.basename(str(fc.getOutput(0))) with arcpy.da.UpdateCursor(fc, ['EF_Type', 'EF_Group']) as cursor: for row in cursor: val = str(row[0]) if val in School: row[1] = 'School' cursor.updateRow(row) elif val in EmergencyServices: row[1] ='Emergency Services' cursor.updateRow(row) When I run my script, no error is thrown, but the second field does not update with the new value. What am I doing wrong? I've based this off answers to similar questions here, but can't seem to troubleshoot the issue.

cursor.updateRow(row)out at the end, outside of your if, elif blocks instead of individual ones, but I don't think that would cause it not to work. Have you tried printing out some of the values ofvalto see if you are getting the expected values? Also, using a dictionary, with keys equal to your type and values with your lists would be easier if you have many types to enumerate (ietypes = {'School':['CollegesUniversities',...]}). Then you could loop through the keys andif val in types[key]: row[1] key, etc.str(row[0])is what you are expecting. Also make sure EF_Group is correct field type and length. You could also try:val = row[0].replace(' ','').upper()and make all items in list uppercases to make sure no whitespaces or letter case is causing the ifs not to match.