I am a new computer science student, and now we know the Python language. It is beautiful, but I have many problems with it. Sorry, I can solve this question. enter image description here
I tried to solve it using the Dictionary, but I did not know how to represent it well. I only know how to represent simple things.
When you're thinking about how to represent a problem in the form of a data structure, you should usually start by thinking about what you will need to do with the structure -- what questions do you want it to be able to answer? For the case of a maze, I'd probably start with "given a cell in the maze, I want to know what other cells I can get to".
With a dictionary, you could make each cell a key, with the values being a list of the other reachable cells. Hence:
Given that structure it'd be pretty easy to write a BFS that would tell you the shortest path between any two cells.