Hi! I'm doing a homework assignment for CS50 AI over at edx.org.
The requirement to is fill in a single function with a pathfinding algorithym. The data returned by that function is known as 'path.' Almost every single line of code has an apparent meaning to me, except the syntax on this is leaving me guessing:
Path is then referred to as a multidimensional array and the intent of that code is obvious.
How does this turn path into a multidimensional array? What data format would 'path' originally have to have been for this to make sense?
(Let me know is you need to see more code, it's a public learning problem.)
The part on the left of the + is a list with inside it a tuple.
I'm assuming that path already was a list, in which case a the two lists (the one with the tuple and path) are concatenated into a new list, which is then assigned to the path variable.
The fact that a regular Python list containing (hopefully only) tuples is sort of like a multi-dimensional array (unless you add other stuff to it) is confusing to people who are used to strongly-typed statically-typed languages.
I'm just getting over this, because often if you really needed a true multi-dimensional array for some kind of computation you'd probably be using NumPy anyway.
In terms of other kinds of multi-dimensional arrays I just know out-of-the-box Python will pretty much allow you to add pretty much anything to a list.
If it should only have certain kinds of things, it is up to you to be careful in what you put into it.
RTFJD (the JavaDocs are your friends!) If you haven't read them in a long time, then RRTFJD (they might have changed!)