I've been self learning Python. Now I want to play a little with the Python code block so I can be more comfortable building my own expressions later on. Right now I am just playing with this water resource layer. I created the new field called "play", basically what I want to do is write a simple expression so that if the "WETLAND_TY" field holds the value of "Freshwater Forested/Shrub Wetland". the new "play" field will return a value of 1, otherwise it will return value 5.
I don't know what goes wrong here.
I know this issue can be dealt simply with select by attribute. But I am learning to build my expressions for some more complicated projects, so I'd like to finish it with Python expression.
def NewValue(Area): '''I was playing with a different field: Area''' if Area >= 0 and Area < 30000: return 1 elif Area >= 30000 and Area < 800000: return 2 else: return 3
And this time it worked. I just don't understand what's wrong with what I wrote the first time.
Could anyone help me with this?