μκ³ λ¦¬μ¦ λ¬Έμ νμ΄
[python] νλ‘κ·Έλλ¨Έμ€ μμ£Όνμ§ λͺ»ν μ μ
JihyunLee
2019. 10. 29. 16:15
λ°μν
μμ£Όνμ§ λͺ»ν μ μ
νλ‘κ·Έλλ¨Έμ€μ μμ£Όνμ§ λͺ»ν μ μ λ¬Έμ λ₯Ό νμ΄μ¬ μ½λλ‘ νμ΄λ³΄μλ€.
collections ν΄λμ€λ₯Ό μ¬μ©νλ μμ£Ό νΈνκ² ν μ μμλ€.
λμ μ½λ :
import collections
participant = ["leo", "kiki", "eden"]
completion = ["kiki", "eden"]
answer = ''
p = collections.Counter(participant)
c = collections.Counter(completion)
print(p-c)
answer = list((p-c).keys())
return answer[0]
collections.Counterμ λν 곡λΆλ μ¬κΈ°μ ν μ μμλ€.
λ°μν