본문 바로가기
프로그래머스

Level1 음양 더하기

by ysunee 2022. 2. 2.
def solution(absolutes, signs):
    
    n=len(absolutes)
    sum=0
    
    for i in range(n):
        if(signs[i]): sum+=absolutes[i]
        else: sum+=absolutes[i]*(-1)    
    return sum

'프로그래머스' 카테고리의 다른 글

Level1 소수 만들기  (0) 2022.02.02
Level1 내적  (0) 2022.02.02
Level1 없는 숫자 더하기  (0) 2022.02.02
Level2 프린터  (0) 2022.01.28
Level2 짝지어 제거하기  (0) 2022.01.27

댓글