I have a question regarding the error I have in the python output
In the first image I show how in python if it works and in dynamo it doesn’t
where can I find the conversions given in python and dynamo as instead of using
print we use Out
I have a question regarding the error I have in the python output
In the first image I show how in python if it works and in dynamo it doesn’t
where can I find the conversions given in python and dynamo as instead of using
print we use Out
hi
OUT not like PRINT, you deal with OUT like a variable or sth. so you should write like this
mData = 3 > 2
OUT = mData
Thank you very much for your answer, but what I am trying to understand is how the if and else works in python dynamo, how do I get it to answer if it is true or false
I know that if it is true write true but I could have written another text between the quotes for example
That part doesn’t matter because your code is failing as soon as it hits OUT(mData)
.
OUT is the python node outputs in the same way that IN is the python node inputs. It’s not really a variable. You would define a variable to list in the OUT outputs.
@khuzaimah.ElecEng was right in the first part - you should use = because OUT doesn’t work like print.
also the if statement is allright, but you need to make another empty list to populate it with the outcome of it. So
mData = 3 > 2
if mData:
text.append("true")
else:
text.append("false")
OUT = [mData, text]
This is pretty close but the indents are off and there are extra lists (one of which hasn’t been defined).
mData = 3 > 2
if mData:
text = "Excellent"
else:
text = "Incorrect"
OUT = mData, text
If you’re returning a single item (for your strings) you don’t need to append it to a list (unless that’s the structure you want). You also don’t have to create a list for the returned outputs.
@filip.kabelis Thank you very much for the reply
@Nick_Boyts Great, Just what I was looking for
excellent answer, every day I understand a little more python and dynamo thank you very much