T
T
timur_gis2018-11-18 23:20:35
Python
timur_gis, 2018-11-18 23:20:35

How to write an expression in Python?

Same thing only in Python
VBS code block:

Dim density
If [поле значений] < 100 Then
  density = "low"
elseif [поле значений] < 300 Then
  density = "medium"
else
  density = "high"
end if

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
spaceatmoon, 2018-11-19
@timur_gis

Wow, I'm drugged here. It seems like nothing.

density = ['low', 'medium', 'high'][
  (     0 if x < 100 
   else 1 if x < 300
   else 2
  )]

E
Elvis, 2018-11-18
@Dr_Elvis

I don’t know what [value field] means for you, but here:

density = ''
if a < 100:
    density = 'low'
elif a < 300:
    density = 'medium'
else:
    density = 'high'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question