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
vss121 committed Jul 17, 2022
1 parent 4750c9c commit 49daed0
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions 김예경/42888 오픈채팅방.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
def solution(record):
#딕셔너리에 이름 처리하기
name={}
for i in range(len(record)):
if record[i][0] == 'L':
continue
id_name = record[i].split()
name[id_name[1]] = id_name[2]

#answer(리스트)에 출력 메세지 넣기
answer = []
for i in range(len(record)):
if record[i][0] == 'E':
answer.append(f"{name[record[i].split()[1]]}님이 들어왔습니다.")
elif record[i][0] == 'L':
answer.append(f"{name[record[i].split()[1]]}님이 나갔습니다.")

return answer

#record = ["Enter uid1234 Muzi", "Enter uid4567 Prodo","Leave uid1234","Enter uid1234 Prodo","Change uid4567 Ryan"]
#print(solution(record))

0 comments on commit 49daed0

Please sign in to comment.