I will give you an integer. Give me back a shape that is as long and wide as the integer. The integer will be a whole number between 1 and 50.
Example
n = 3, so I expect a 3x3 square back just like below as a string:
+++
+++
+++
Solution:
def generate_shape(n: int) -> str:
return "\n".join("+" * n for i in range(n))
'나는 이렇게 학습한다 > Algorithm & SQL' 카테고리의 다른 글
| 0115. Name on billboard (0) | 2023.01.15 |
|---|---|
| 0114. Are arrow functions odd? (0) | 2023.01.15 |
| 0112. Tip Calculator (0) | 2023.01.13 |
| 0111. You Can't Code Under Pressure #1 (0) | 2023.01.12 |
| 0110. altERnaTIng cAsE <=> ALTerNAtiNG CaSe (0) | 2023.01.11 |