Python warning Outputappend problem

Hi all,

I’ve used this code on another script and modified it slightly and it’s causing all sorts of problems.

Its probably something very minor, but it’s driving me nuts.

please see code below and the warning, any advise would be appreciated.

Cheers

<img

Firstly, paste your code as you’ll get a better answer
Secondly, you’re missing a dot between “output” and “append” in the final else statement.

1 Like

Here’s the full code:

output = []

for i in IN[0]:
    if i == IN[1]:
        output.append(IN[4])
    elif i == IN[2]:
        output.append(IN[5])
    elif i == IN[3]:
       output.append(IN[6])
    else:
        output.append("data not valid")

OUT = output

1 Like

@James_Washbourne or you can do it with DesignScript like this

{a,b,c,d};

f = [Imperative]
{
if ( a == b )
{return = "P";
}
elseif ( a == c )
{return = "T";
}
elseif ( a == d )
{return = "C";
}
else
{return = "Data Not Valid";
}
};

Revisions.dyn (15.0 KB)

Mohammadz,

This is an interesting method what does the f = [Imperative] line do.

I found a work around by just taking the first character the string out. hahaha, very low tech but it did the trick :joy:

Cheers