From 620cbda096c6d97118fcb163f589ab4508ee4b13 Mon Sep 17 00:00:00 2001 From: rl544 <111494264+rl544@users.noreply.github.com> Date: Sat, 17 Dec 2022 20:08:47 +0900 Subject: [PATCH] =?UTF-8?q?uploaded=20at=202022.=2012.=2017.=20=EC=98=A4?= =?UTF-8?q?=ED=9B=84=208:08:47?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- programmers/음양 더하기/solution.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 programmers/음양 더하기/solution.py diff --git a/programmers/음양 더하기/solution.py b/programmers/음양 더하기/solution.py new file mode 100644 index 0000000..8caa989 --- /dev/null +++ b/programmers/음양 더하기/solution.py @@ -0,0 +1,13 @@ +// [문제 링크]: https://school.programmers.co.kr/learn/courses/30/lessons/76501 + +def solution(absolutes, signs): + ans = [] + answer = 0 + for i in range(len(absolutes)): + ans.append([]) + if signs[i] == True: + ans[i] = absolutes[i] + else: + ans[i] = absolutes[i]*(-1) + answer = answer + ans[i] + return answer \ No newline at end of file