프로그래머스 추억 점수1 프로그래머스 추억 점수(Java/Python) 풀이 파이썬 풀이1 : 리스트와 반복문, 조건문을 사용해서 구현하면 되는 간단한 문제였다. def solution(name, yearning, photo): answer = [] for case in photo: caseSum=0 for people in case: if people in name: idx=name.index(people) caseSum+=yearning[idx] else: pass answer.append(caseSum) return answer 파이썬 풀이2 : zip함수 이용해서도 해결가능하다. def solution(name, yearning, photo): answer = [] year_dict={n:y for n,y in zip(name,yearning)} ans=0 for p.. 2023. 4. 5. 이전 1 다음