I am trying to calculate a roadway pedestrian restriction based on its functional class, using if/else logic in Python. Every time I enter this, it only turns up 'No'. The categories are strings, and I am hoping to return strings. I have double-checked that the arguments for the values in FUNC_CLASS are accurate, so I am not sure why it will only turn up 'No's. I'm new to Python.


def Reclass(function):
  if (function =="U / FWY OR EXP") or (function =="R / INTERSTATE") or (function =="U / INTERSTATE"):
    return 'Yes'
    return 'No'


Reclass ( !FUNC_CLASS! )
  • What are the values which are feeding into the function? I'd personally use Python to its fullest in the comparison: if (function in ['U / FWY OR EXP','R / INTERSTATE','U / INTERSTATE']): – Vince Aug 2 at 17:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.