Skip to content

Commit 81708b6

Browse files
committed
[PGS] 오픈채팅방 / Level 2 / 19분 / 성공
1 parent cddd575 commit 81708b6

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
def solution(record):
2+
answer = []
3+
dict = {}
4+
5+
# 사용자 DB 딕셔너리
6+
for i in range(len(record)):
7+
temp = record[i].split()
8+
if temp[0] == 'Enter' or temp[0] == 'Change':
9+
dict[temp[1]] = temp[2]
10+
11+
# Enter, Change, Leave 순회
12+
for i in range(len(record)):
13+
temp = record[i].split()
14+
if temp[0] == 'Enter':
15+
answer.append(f"{dict[temp[1]]}님이 들어왔습니다.")
16+
elif temp[0] == 'Leave':
17+
answer.append(f"{dict[temp[1]]}님이 나갔습니다.")
18+
19+
20+
return answer

0 commit comments

Comments
 (0)