#๐Ÿ”’ Creating board

4 messages ยท Page 1 of 1 (latest)

near plank
#

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.
fringe violetBOT
#

@near plank

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

fringe violetBOT
#

@near plank

Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.