[프로그래머스] [1차] 비밀지도

psy4072·2022년 10월 30일
0

Algorithm

목록 보기
16/23



def solution(n, arr1, arr2):
	answer = []
    for x, y in zip(arr1, arr2):
    	tmp = bin(x|y)[2:].zfill(n)
        code = tmp.replace("1", "#").replace("0", " ")
        answer.append(code)
    return answer

bin()

숫자를 10진수 -> 2진수로 변경해주는 함수

zfill()

숫자 앞 0 출력

"123".zfill(5)
=> 00123
profile
Ⓓ🅰️🅣🄰 ♡♥︎

0개의 댓글