Skip to content

Commit

Permalink
[3주차] : 허원일 - 오픈채팅방 lv.2 (CBNU-Nnet#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
wonza-hub committed Jul 15, 2022
1 parent aadafe6 commit b1d34bd
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions 허원일/오픈채팅방.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
def solution(record):
answer = []
uid_arch = {} # 유저아이디 : 닉네임 을 저장하는 딕셔너리

# 반복문을 돌며 기록 처리
for rec in record:
rec_splited = rec.split()
if (rec_splited[0] == 'Enter') or (rec_splited[0] =='Change'):
uid_arch[rec_splited[1]] = rec_splited[2]

# 반복문을 돌며 처리된 기록을 바탕으로 메시지 저장
for rec in record:
rec_splited = rec.split()
if rec_splited[0] == 'Enter':
answer.append(f"{uid_arch[rec_splited[1]]}님이 들어왔습니다.")
elif rec_splited[0] == 'Leave':
answer.append(f"{uid_arch[rec_splited[1]]}님이 나갔습니다.")

return answer

0 comments on commit b1d34bd

Please sign in to comment.