인프런 영문 브랜드 로고
인프런 영문 브랜드 로고

Inflearn Community Q&A

김동연's profile image
김동연

asked

Introduction to Python for Programming and Data Science

dict 타입의 key - value 프로그램을 value - key로 변경하여 value 값으로 key 찾기

Resolved

Written on

·

259

1

#함수를 통해서 만들어보면
def reverse_dict(dict_tpye_list):
    temp_dict = {}
    for key , value in dict_tpye_list.items():
        temp_dict[value] = key
    result = temp_dict
    return result

country_code = { "America":1 , "Korea":82 , "France":33,  "Germany":49}
reverse_country_code = reverse_dict(country_code)
print(reverse_country_code)
print(reverse_country_code[82])
pythonbigdata

Answer 1

0

TeamLab님의 프로필 이미지
TeamLab
Instructor

감사합니다!

김동연's profile image
김동연

asked

Ask a question