From the course: Grasshopper and Rhino: Python Scripting

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Lists and tuples

Lists and tuples

From the course: Grasshopper and Rhino: Python Scripting

Start my 1-month free trial

Lists and tuples

- [Instructor] When working in Grasshopper, it's more than likely you've come across and used lists to store data such as numbers, strings, or geometry. A list is then simply a container to store items in an ordered manner. When working in Grasshopper, if a component returns more than one item, it is like a list or a tray containing lists. Let's have a look at some of the fundamentals of using lists in Python. In a new Grasshopper file, let's go ahead and place a Python component and double click to open it up. Creating a list can be done in a few different ways. The simplest method is by using two square brackets, open, then closed. This will create an empty list. For example, let's create an empty list by creating a variable named empty list and I'll assign to this two square brackets, open, then closed. We now have an empty list which we can check by printing out variable empty list and hit test and there you can see our empty list. We can also create a list with predefined items…

Contents