Notice
Recent Posts
Recent Comments
«   2024/10   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
Tags
more
Archives
Today
Total
관리 메뉴

CHIqueen

[Intro] Add Border 본문

프로그래밍/CodeSignal

[Intro] Add Border

CHIqueen 2020. 3. 17. 15:56

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