프로그래머스 비밀지도

William Parker·2022년 12월 6일

n = 6
arr1 = [46, 33, 33 ,22, 31, 50]

arr2 = [27 ,56, 19, 14, 14, 10]

bin1 = []
bin2 = []
bin3 = []
answer =[]
for i in range(0, n):
bin1 += [(arr1[i] | arr2[i])]

for j in range(len(arr1)):
bin2 += [format(bin1[j], 'b')]

if n > len(bin2[j]):
    bin3 += [bin2[j].zfill(n)]
else:
    bin3.append(bin2[j])

for k in bin3:
temp=k.replace("1","#").replace("0"," ")
answer.append(temp)
print(answer)

profile
Developer who does not give up and keeps on going.

0개의 댓글