For loop with 2 arguments

Hello,

i’m kind of new to python, perhaps someone can point me in the right direction?

I’ve created a definition with some if statements inside. Now when the input is a list I get only 1 value as output, right? So how can I create a for loop in a definition with 2 arguments that will return me the value I need for each value in the list?

Thanks a lot in advance!

2018-06-05_14-18-22|525x500

You have not uploaded anything, can you show what you’ve tried?

And why do you need python?

1 Like

Hi Jonathan,

good point. I just want to learn how this is done in python. With code block it’s pretty simple:
x>=0 && y>=0 ? 0 :
x>=0 && y<0 ? 90 :
x<0 && y<0 ? 180 :
x<0 && y>=0 ? 270 : 0;

But in Python i’ve to use this for loop, otherwise the output is only a single value.

2018-06-05_17-32-19

You’re almost there, try instead of using “return” define an empty list in line 9:

output = []

And replace “return …” with:

output.append(YourValue)

This should get you going:

3 Likes

great! Thanks

This is a little cleaner, but you get the point :slight_smile:

2 Likes