CHIqueen
[Intro] Add Border 본문
Given a rectangular matrix of characters, add a border of asterisks(*) to it.
def addBorder(picture):
a = len(picture[0]) + 2
return ["*" * a] + ["*" + i + "*" for i in picture] + ["*" * a]
"*"+i+"*"말고 i.center()쓰는것도 좋은 방법이다.
'프로그래밍 > CodeSignal' 카테고리의 다른 글
[Intro] palindromeRearranging (0) | 2020.03.17 |
---|---|
[Intro] Are Similar? (0) | 2020.03.17 |
[Intro] alternationSums (0) | 2020.03.17 |
[Intro] reverseParenthese (0) | 2020.03.11 |
[Intro] Sort by Height (0) | 2020.03.11 |
Comments