To preface, the following is not allowed.
Keywords
for
in (this includes the use of contains() as in simply invokes this method)
global
lambda
nonlocal
Built in functions
all()/any()
map()/filter()
min()/max()/sum()
eval()/compile()/exec()
enumerate()
globals()/locals()
Modules
sys
typing
unittest
any module you have written e.g. emitter.
every other module is not allowed
Hi guys, I want to make a board using a nested list of strings. Something like this:
-------
>>> self.width, self.height
(8, 3)
>>> create_board() # board split across multiple lines for readability
[
[' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
[' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
[' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ']
]```
I will need to do it in a way so that in the future, I can format the board to look more presentable like this:
``` Example 1
---------
>>> self.board # board split across multiple lines for readability
[
[' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
[' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
[' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ']
]
>>> self.print_board()
+--------+
| |
| |
| |
+--------+
Example 2
---------
>>> self.board # board split across multiple lines for readability
[
['A', ' ', ' ', ' ', ' ', ' ', ' ', '0'],
[' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
['B', ' ', ' ', ' ', ' ', ' ', ' ', '1']
]
>>> self.print_board()
+--------+
|A 0|
| |
|B 1|
+--------+```
Thanks.