This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Python Data Structures - A Game-Based Approach | |
| Reading a maze from a text file | |
| Robin Andrews - https://compucademy.net/ | |
| """ | |
| def read_maze(file_name): | |
| """ | |
| Reads a maze stored in a text file and returns a 2d list containing the maze representation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Python Data Structures - A Game-Based Approach | |
| Reading a maze from a text file | |
| Robin Andrews - https://compucademy.net/ | |
| """ | |
| def read_maze(file_name): | |
| """ | |
| Reads a maze stored in a text file and returns a 2d list containing the maze representation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Python Data Structures - A Game-Based Approach | |
| Stack challenge | |
| Robin Andrews - https://compucademy.net/ | |
| """ | |
| import stack | |
| string = "gninraeL nIdekniL htiw tol a nraeL" | |
| reversed_string = "" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Stack: | |
| def __init__(self): | |
| self.items = [] | |
| def is_empty(self): | |
| # return len(self.items)==0 | |
| return not self.items | |
| def push(self, item): | |
| self.items.append(item) |
NewerOlder