Skip to content

Commit 8060d49

Browse files
committed
81차 3번 문제 풀이
1 parent ba1af42 commit 8060d49

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

live8/test81/문제3/박희경.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from collections import *
2+
3+
4+
def solution(records):
5+
result = []
6+
answer = []
7+
user = defaultdict()
8+
for record in records:
9+
cmd = list(map(str, record.split()))
10+
if cmd[0] != 'Leave': # {유저 아이디: 닉네임}
11+
user[cmd[1]] = cmd[-1]
12+
if cmd[0] != 'Change':
13+
result.append([cmd[0], cmd[1]])
14+
15+
for res in result:
16+
if res[0] == 'Enter':
17+
answer.append(user[res[1]] + "님이 들어왔습니다.")
18+
if res[0] == 'Leave':
19+
answer.append(user[res[1]] + "님이 나갔습니다.")
20+
21+
return answer

0 commit comments

Comments
 (0)