-
카테고리
-
세부 분야
프로그래밍 언어
-
해결 여부
미해결
코드를 작성해봤는데 어디 가 잘못된건지 모르겠습니다 ㅠㅜ
19.05.16 20:29 작성 조회수 143
0
어디가 잘못된건지 모르겠습니다. ㅜㅜ
dict = {'America': 1, 'UnitedKingdom': 44, 'Germany': 49, 'SouthKorea': 82, 'Japan': 81}
def find_the_key(dict):
list_keys_in_dict = list(dict.keys())
list_values_in_dict = list(dict.values())
n = int(input("찾고 싶은 나라의 번호 코드를 입력하시오 \n (00을 누르면 종료) \n"))
while n != 00:
if n in list_values_in_dict:
idx_of_values = list_values_in_dict.index(n)
result = list_keys_in_dict[idx_of_values] + "입니다"
elif n not in list_values_in_dict:
result = "번호 코드가 없습니다 다시 입력하세요"
n = int(input("찾고 싶은 나라의 번호 코드를 입력하시오 : \n 00을 누르면 종료"))
else:
result = "종료합니다"
return print(result)
find_the_key(dict)
답변을 작성해보세요.
0
TeamLab
지식공유자2019.05.20
print 문장을 리턴할 수는 없습니다. print는 반환값이 없는 함수 입니다. return에는 반드시 반환값을 적어주어야 합니다. print문을 써야 한다면 반환된다음 print 문을 써주면 됩니다.
함수 부분을 다시 보시면 좋을 거 같습니다.
답변 1