Post History
Python 3, 47 42 40 bytes -2 bytes thanks to bastolski lambda n:'#'*n+('\n#'+' '*(n-2)+'#')*~-n Try it online! Python's string multiplication is really useful.
Answer
#3: Post edited
# [Python 3], ~~47~~ 42 bytes- ```python
lambda n:'#'*n+('#'+' '*(n-2)+'#')*(n-1)- ```
- [Try it online!][TIO-ksth5zpv]
- Python's string multiplication is really useful.
- [Python 3]: https://docs.python.org/3/
[TIO-ksth5zpv]: https://tio.run/##K6gsycjPM/6fZhvzPycxNyklUSHPSl1ZXStPW0M9Jk9ZXVtdQV1LI0/XSFMbKKwJYhpq/i8oyswr0UjTMNbU5IKxTZHYhgaamv8B "Python 3 – Try It Online"
- # [Python 3], ~~47~~ ~~42~~ 40 bytes
- *-2 bytes thanks to [bastolski](https://codegolf.codidact.com/users/54221)*
- ```python
- lambda n:'#'*n+('
- #'+' '*(n-2)+'#')*~-n
- ```
- [Try it online!][TIO-ksth5zpv]
- Python's string multiplication is really useful.
- [Python 3]: https://docs.python.org/3/
- [TIO-ksth5zpv]: https://tio.run/##K6gsycjPM/6fZhvzPycxNyklUSHPSl1ZXStPW0M9Jk9ZXVtdQV1LI0/XSFMbKKypVaeb97@gKDOvRCNNw1hTkwvGNkViGxpoav4HAA
#2: Post edited
# [Python 3], 47 bytes- ```python
lambda n:'#'*n+'\n'+('#'+' '*(n-2)+'#\n')*(n-1)- ```
- [Try it online!][TIO-ksth5zpv]
- Python's string multiplication is really useful.
- [Python 3]: https://docs.python.org/3/
[TIO-ksth5zpv]: https://tio.run/##K6gsycjPM/6fZhvzPycxNyklUSHPSl1ZXStPWz0mT11bA8jWVldQ19LI0zXS1FZXBgpqgjiGmv8LijLzSjTSNIw1NblgbFMktqGBpuZ/AA "Python 3 – Try It Online"
- # [Python 3], ~~47~~ 42 bytes
- ```python
- lambda n:'#'*n+('\n#'+' '*(n-2)+'#')*(n-1)
- ```
- [Try it online!][TIO-ksth5zpv]
- Python's string multiplication is really useful.
- [Python 3]: https://docs.python.org/3/
- [TIO-ksth5zpv]: https://tio.run/##K6gsycjPM/6fZhvzPycxNyklUSHPSl1ZXStPW0M9Jk9ZXVtdQV1LI0/XSFMbKKwJYhpq/i8oyswr0UjTMNbU5IKxTZHYhgaamv8B "Python 3 – Try It Online"
#1: Initial revision
# [Python 3], 47 bytes ```python lambda n:'#'*n+'\n'+('#'+' '*(n-2)+'#\n')*(n-1) ``` [Try it online!][TIO-ksth5zpv] Python's string multiplication is really useful. [Python 3]: https://docs.python.org/3/ [TIO-ksth5zpv]: https://tio.run/##K6gsycjPM/6fZhvzPycxNyklUSHPSl1ZXStPWz0mT11bA8jWVldQ19LI0zXS1FZXBgpqgjiGmv8LijLzSjTSNIw1NblgbFMktqGBpuZ/AA "Python 3 – Try It Online"