프로그래머스 - 오픈채팅방


프로그래머스 - 오픈채팅방

12345678910111213141516171819def solution(record): answer = [] info = dict() rec = [] msg = {"Enter":"님이 들어왔습니다.", "Leave":"님이 나갔습니다."} for r in record: tmp = r.split() if tmp[0] == "Leave": rec.append((tmp[0],tmp[1])) else: info[tmp[1]] = tmp[2] if tmp[0] == "Change": continue rec.append((tmp[0],tmp[1])) for r in rec: answer.append(info[r[1]]+msg[r[0]]) return answerColored by Color Scriptercs dictionary 형태로 uid에 대한 닉네임 정보 갱신...



원문링크 : 프로그래머스 - 오픈채팅방