what is the python expression for defining a range of numbers?

I have tried numerous combinations but cannot get a simple range of angles (100 -200) to compute correctly.

Screen shot :

Range in Field Calculator needed

if !ET_Angle! > 100 and !ET_Angle! < 200

To be more complete, put this in the codeblock:

def LeftOrRight(value):
    if value > 100 and value < 200:
         return "LEFT"
         return "RIGHT"

And in the calculation area, just put:

  • 2
    So many people ignore the codeblock. It can be very powerful.
    – Radar
    Jun 15 '11 at 18:13
  • I think they ignore it because the term "code" is rather intimidating unless you are familiar with the language.
    – Nathanus
    Jun 15 '11 at 18:23
  • Awesome! That's just what we needed! Much Thanks!!
    – sirgeo
    Jun 15 '11 at 19:53
  • You got it. Sometimes a few examples can make things clearer.
    – Nathanus
    Jun 15 '11 at 20:17
  • i always save these code solutions and i tried using previously saved codeblocks for this today, but needed further schooling on formulating range expressions... not really intimidated by python just exacerbated sometimes due to time constraints and lack of Google-Fu when looking for the answers... GSE is always a great help for filling in the gaps with Google-Fu .
    – sirgeo
    Jun 15 '11 at 21:57

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.