From 530df69342c94f23c33f28cb18343823e21308aa Mon Sep 17 00:00:00 2001 From: huisuu Date: Mon, 12 Aug 2024 21:00:32 +0900 Subject: [PATCH] 20.py --- HSKIM/11to20/20.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 HSKIM/11to20/20.py diff --git a/HSKIM/11to20/20.py b/HSKIM/11to20/20.py new file mode 100644 index 0000000..41f3642 --- /dev/null +++ b/HSKIM/11to20/20.py @@ -0,0 +1,16 @@ +def solution(participant, completion): + h = {} + + for p in participant: + if p in h: + h[p] += 1 + else: + h[p] = 1 + + for c in completion: + h[p] -= 1 + + # .keys()는 딕셔너리의 모든 키(key)를 반환 + for key in h.keys(): + if h[key] > 0: + return key \ No newline at end of file