코딩테스트/Python

[프로그래머스/Python] 음양 더하기

짐니♡ 2025. 9. 24. 00:16

 

 

def solution(absolutes, signs):

    total = 0 
    
    for i in range(0,len(absolutes)):
        if signs[i] == True:
            total += absolutes[i]
        else:
            total += (absolutes[i] * (-1))
    
    return total