How to run it repetitive?

image
Hello,

How can i make it repetive like “hip,hip,hurra” need i a empty list to append my strings?

for hurra_counter in range(1,4):
    for hip_counter in range(1,3):
	    OUT = "Hip"
    OUT = "Hurra !"

hi,

yes, you have to create a list before all the loops and then append strings to it.

x = []
a = []

for hurra_count in range(1,4):
    for hip_count in range(1,3):
	    OUT = "Hip"
	z = a.append(hip_count)
    OUT = "Hurra !"
    y = x.append(hurra_count)

    OUT = x,a

it is pit off,… :confused:

2020-08-04_12h51_05

How about this?

image

How do you paste code with indents or did you have to do it manually?

1 Like

so it is no need to store the strings in a variable, i can append them direktly!

and the doubling of “x” doesn`t matter, because they are in 2 diferent loops?

2020-08-04_14h38_46

I’ve only been learning Python for 2 months… So my understanding is very basic…

But x = [ ] creates a list.
I’m appending (adding to the end of the list, which I have called x) on each loop.

Hope this helps. :slight_smile:

1 Like

I explain a little about Python in this presentation: https://github.com/Amoursol/dynamoPython/wiki/Diving-Deeper:-A-Beginners-look-at-Python-in-Dynamo :slight_smile: It should be useful conceptually!

Also, have a look at https://github.com/Amoursol/dynamoPython which is a repository of 60+ Dynamo Python graphs (You can copy paste into nodes) from the community.

And then check out https://dynamopythonprimer.gitbook.io/dynamo-python-primer/, an awesome resource by @oliver.green!

4 Likes

Ooooo… I didn’t know about dynamo python primer!!

Thankyou :slight_smile:

1 Like

You are most welcome @Alien! It’s a community creation by Oliver and super awesome :slight_smile:

1 Like