# Create a loop with help of Python or any other

Hello,

I am very beginner in use of Dynamo and Python. Would you please help me to build a script, which is going to read 6 variables from previous Nodes. If test RH>MaxRH is true, then a recalculation of RH is required. Please see the image, I would really appreciate any help. Thank you.

SVP=10^(30.59052-(8.2Math.Log10((((aa+273.16)))+(2.4804/1000)(aa+273.16))-(3142.31/((b)+273.16))));

AbsHum=(0.621971SVP)/(94.502-(1*SVP));NewRH=bb/AbsHum;

I would highlight that what you are doing is design script and not python. If you was after python you need to look for a node called â€śPython Scriptâ€ť or similar.

There is some basic examples of python code on this github page that may help guide you on python. https://github.com/Amoursol/dynamoPython

1 Like

This is how you can write while loop in Design script.

2 Likes

Sorry, I do not understand this. Do you mind to explained it a little bit more?

As you see, in your design script code block you are missing return = [imperative] also you are missing your loop (while/for) etc. my post was just an example of design script sintax for codeblock loop.

Hi @ml31, I think what Jan and Brendan point out is that your node fails because the syntaxe is a mix between Designscript (working for code blocks) and Python (working in Python node).

For exemple your first IF statement is written without parenthesis as in Python, the second IF has parenthesis like in Designscript.

Find out on the net the correct DS syntaxe, correct it and you will make it work in the code block.

Also, I am no expert as I am learning it, but python is more efficient for this if you want to use a Python node (because DS uses a lot of parenthesis, semicolons, brackets as you can see in Janâ€™s Pic.

All the best