Python absolute value

hello, I am trying to get rid off the absolute value, but I don’t understand why I am getting error

xVal = IN[0]
xout=
for x in xVal:
b = abs(x):
if b<150:
xout.append("Less than 150 Pipe is " + str(b))
else:
xout.append('Cool keep going ’ + str(b))

OUT = xout

@abdu2736 what’s the error?

image

i already tried that but still the same :confused: !!

Alright, so like Salvo said: what’s the error message?

You need to indent line 4, and then further indent the following lines :slight_smile:

hi martin not sure if I understand it can you please rearrange it for me:

xVal = IN[0]
xout=[]
for x in xVal:
b = abs(x)
if b<150:
	xout.append("Less than 150 Pipe is " + str(b))
else:
	xout.append('Cool keep going ' + str(b))

OUT = xout

Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 4, in
TypeError: bad operand type for abs(): ‘NoneType’

are the values in “x” strings? They need to be numbers.

same problem

@abdu2736

xVal = IN[0]
xout=[]
for x in xVal:
	b= abs(x)
	if b<150:
		xout.append("Less than 150 Pipe is " + str(b))
	else:
		xout.append('Cool keep going ' + str(b))

OUT = xout

thank you i think the problem was it because of the null value, but all is good now :slight_smile: