Q:

Calculate field value based on lat long. Have longitude values which are negative?

Very new to python, fairly experienced with ArcMap. I am trying to create an alphanumeric index based on point locations
My code string for the numeric part is here:
def calc(!LONG_x!):

    if !LONG_x! >= -113.90550 and !LONG_x! <= -113.90559:
        return "05"
    else:
        return "0"

I continue to get an error 000989 for syntax. What am I doing wrong?

A:

You can't use punctuation marks in variable names in python. Your function should probably read more like this:
def calc(LONG_x):
    if LONG_x >= -113.90550 and LONG_x <= -113.90559:
        return "05"
    else:
        return "0"

You can then pass in !LONG_x! as an argument to the function.
eg. result = calc(!LONG_x!)

