Dynamically create a List of Lists

Hi there, new joiner here (and beginner coder)
I need some help :frowning: I have a project that needs a control table. This control table has 3 cols (A, B, & C) and its length (number of columns) is determined at run time, when the table is created. Col A is also populated when the table gets created, Cols B & C are initially null, and their entries are changed as the code progresses. I hope his makes sense!

I was implementing this in Scratch as 3 separate lists using the index to tie it all together, but it became really complicated when needing to read, add, change a row. Then I read about “list of Lists” in Snap.

I am stuck on: How do I create a the table, 3 by X when I don’t know the X? Also when a 3 by 10 table has been created at run time, how do change a single entry in the table , for example in the 2nd col?

Any help to point me in the right direction would really be appreciated

Create a list of empty lists, and when you find X, add items to the inner lists.
Use the item block with the outer list to get the inner lists.

Do you mean "number of rows" ?

This might work:

Awesome !!!

Thats exactly what I needed - and yes there was a typo above!

Tested with and totally get what its doing... On with the the project !

Thank you

Wait, if the three columns are the same length, are their contents related? I mean, does the fifth thing in column A go with the fifth thing in column B and the fifth thing in column C? If so, I wouldn't make a list of columns at all. I'd make a list of rows! Then you can add a new entry with

Starting is easier too; instead of starting with a list of three empty lists, you just start with a plain old empty list.

Edit: Oh, wait, you want to start with values only in A, but that's fine, you just

What's the application? Are you writing an LALR parser or something?

Oh, and, welcome to Snap!!

I thought I'd update the post (for others) Both versions work, see test implementations below... I got tguneysu's version to work, but bh your version is really simple... I should have figured this out myself.

as for the project: my son & I are trying to build a simulation of the card game Rummy...