# Calculating parity of address range using to/from left/right ranges using ArcGIS for Desktop?

I have been working on a road center line feature class with left/right, to/from address fields (in ArcGIS Desktop 10.2). Using these fields, is there a way to automate the process of deciphering if the "to" and "from" segments are even, odd, both, or neither(zero) for both "left" and "right" of each segment?

• A screen shot of your data would help? – Hornbydd Sep 19 '16 at 23:01
• What country is your data in? – artwork21 Sep 20 '16 at 0:02
• @artwork21 I am in the U.S. - Texas. – Jennifer Sep 20 '16 at 13:20
• You may want to look at US Census tiger line/street data. This data has the to and from address ranges. Maybe you could somehow use this info as a base to determine even and odd sides of the street. – artwork21 Sep 20 '16 at 13:56
• @artwork21, I have the data already, I would like to automate a way to calculate whether those ranges are even or odd. I was hoping that someone out there might have a python script for this. – Jennifer Sep 20 '16 at 14:36

Here is a simple function (with an example) using modulo that returns 'odd', 'even', both, or 'zero'. You will need to use an update cursor to get the values from your attribute table and populate another attribute(s) in that table with the result of the function.

``````def RightLeft(addto, addfrom):
if addto == 0:
else:
if addto%2 == 0:
else:
if addfrom == 0:
else:
if addfrom%2 == 0: