-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5e310ac
commit d24b544
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# -*- coding: utf-8 -*- | ||
# UTF-8 encoding when using korean | ||
|
||
def func(record): | ||
if record == 0: | ||
return 1 | ||
elif record == 1: | ||
return 2 | ||
return 0 | ||
|
||
def solution(recordA, recordB): | ||
cnt = 0 | ||
for i in range(len(recordA)): | ||
if recordA[i] == recordB[i]: | ||
continue | ||
elif recordA[i] == func(recordB[i]): | ||
cnt = cnt + 3 | ||
else: | ||
if not cnt: | ||
cnt = cnt - 1 | ||
return cnt | ||
|
||
recordA = [2,0,0,0,0,0,1,1,0,0] | ||
recordB = [0,0,0,0,2,2,0,2,2,2] | ||
ret = solution(recordA, recordB) | ||
|
||
|
||
print("solution 함수의 반환 값은", ret, "입니다.") |