I'm working on practising some Python, and I've encountered an error from trying to apply my previous PHP understanding of multidimensional arrays into Python's arrays.
maze_path = [
[
"You are in a forest looking into the shrubbery while sitting on a plane. Do you decide to check it out?",
"yes:Walking in.." = [
],
"no:END_GAME" = []
]
]
This is the array that I'm trying to setup, an array with more than one resolutions that can be iterated through to move to the next areas depending on a set of instructions that are given to the iterator.
I tried to execute my code and ran into the following error (was trying to see if syntax was legitimate):
File "menu.py", line 159 "yes:Walking in..": [ ^ SyntaxError: invalid syntax
I tried changing the = sign into :, == (comparison, worked but not as I expected...) and just nothing with it.
What I am planning on doing with this is iterating on the first level of the array, something like so:
for instruction, resolution in maze_path:
#// do some stuff with each of these informatants
manage( instruction, resolution, maze_path )
Then from that I'll figure out some other issue to do with moving through the array.
The main question: Am I able to make string-based multidimensonal arrays in Python?
dict.listobjects. They are sort of a hybrid between Pythonlistanddictobjects. Among Pythonistas, "array" usually meansnumpy.array, which is a true multidimensional array data-structure. It can also mean the built-inarray.array, but you shouldn't refer tolistobjects, e.g.[1,2,3]nordictobjects, e.g.{'a':1, 'b':2}as "arrays"