← Back to challenges

String Like Square

PythonHardstringsformatting

Instructions

Create a function that takes a number and returns a string like square.

Examples

create_square(-1) ➞ ""

create_square(0) ➞ ""

create_square(1) ➞ "#"

create_square(2) ➞ "##\n##"

create_square(3) ➞ "###\n# #\n###"

create_square(4) ➞ "####\n#  #\n#  #\n####"

"####
#  #
#  #
####"

Notes

N/A

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.