# Python set multiple value

hello, I’m a limted user with python I am trying to set multiple values based on the length of the pipe but I don’t know why it gave the second list as length number, not y value ?

I believe this is the thing you’re looking for.

``````x_val = (IN[0])
y_val = (IN[1])

x = []
for i in x_val:
if i > 3000:
x.append(['Pipe is more than 3000', i])

y = []
for i in y_val:
if i < 3000:
y.append(['Pipe is less than 3000', i])

OUT = x, y``````

…or it is just the value, KR Andreas

thanks for the replying, but it did’t work

thanks for the replying, but it didn’t work

use also the frame (import the libraries)

1 Like

Looks like you’ve an indented block, line 7.
Tab the line out like you’ve done in line 12.

… and there’s a Typo…

there needs to be tabs/spaces here…

It would be good to see the error message

Hope that helps,

Mark

1 Like

updated the script

``````x_val = (IN[0])
y_val = (IN[1])

x = []
for i in x_val:
if i > testx:
x.append(['Pipe is more than: ' + str(testx), i])
elif i < testx:
x.append(['Pipe is less than: ' + str(testx), i])
else:
pass

y = []
for i in y_val:
if i > testy:
y.append(['Pipe is more than: ' + str(testy), i])
elif i < testy:
y.append(['Pipe is less than: ' + str(testy), i])
else:
pass

OUT = x, y``````
1 Like

Here’s a version of the more basic one

``````xVal = IN[0]
yVal = IN[1]

xOut = []
yOut = []

for x in xVal:
if x > 3000:
xOut.append(['Pipe is more than 3000', x])

for y in yVal:
if y <= 3000:
yOut.append(['Pipe is less than or equal to 3000', y])

OUT = xOut, yOut``````
1 Like

it’s really weird, it acts different here

You have to correct the typo I made whilst copying in line 18 by removing the space at the beginning, I’m sorry.

thank you so much, I really appreciate your help

1 Like

Please mark the answer as ‘solution’ if it solved your problem for other users to see.

1 Like