인프런 커뮤니티 질문&답변
dictionary comprehension
해결된 질문
작성
·
166
답변 1
0
미쿡엔지니어
지식공유자
안녕하세요 ithannag님,
질문을 잘 이해를 못하겠네요. 혹시 else를 넣고 싶으신건가요? 그렇다면 if를 앞으로 뺄 수도 있습니다.
incorrect_score_dict = {'Tom': 75, 'Lisa': 75, 'Sarah': 90}
correct_score_dict = {name: score + 5 if score < 80 else score for (name, score) in incorrect_score_dict.items()}
print(correct_score_dict)




