-
카테고리
-
세부 분야
프로그래밍 언어
-
해결 여부
해결됨
dict 타입의 key - value 프로그램을 value - key로 변경하여 value 값으로 key 찾기
19.10.09 12:43 작성 조회수 182
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])
답변을 작성해보세요.
0
답변 1