AnsweredAssumed Answered

What is the proper way to do for and if statements in python?

Question asked by apmartincude on Aug 2, 2017
Latest reply on Aug 2, 2017 by xander_bakker

I am having issues with loops and if statements in python. I keep getting an error on the last line. What am I doing wrong?

 

import arcpy
from arcpy.sa import *
from arcpy import env

sorder=r"C:\Temp\ARCGIS_PROJECT\Tutorial\Final\layers\streamorder"


desc= arcpy.Describe(sorder)

xmin= desc.extent.XMin
ymin=desc.extent.YMin
xmax= desc.extent.XMax
ymax= desc.extent.YMax
count= 0

for columns in range (xmin, xmax):
  pointval= arcpy.GetCellValue_management(sorder,"%s %s" % (columns++,ymin), "1")
  if (pointval== 1, pointval==2, pointval==3):
      count++
print "count= %s" % (count)

Outcomes