본문 바로가기
프로그램/Python 1000제

Python 184제] 파이썬 EXPRESS CHAPTER 7. Programming 11 p361

by 건티 2023. 5. 1.
728x90

출처 : 반크_반크 20년 백서

 

참고풀이]

Problems={"파이썬":"최근에 가장 떠오르는 프로그래밍 언어",
          "변수":"데이터를 저장하는 메모리 공간",
          "함수":"작업을 수행하는 문장들의 집합에 이름을 붙인것",
          "리스트":"서로 관련이 없는 항목들의 모임"}

def Show_words(Problems):
    Str = ""
    i=1
    for word in Problems.keys():
        Str += "("+str(i)+")"
        Str += word + " "
        i+=1
    print(Str)

for question in Problems.values():
    chk = False
    while True:
        if chk: break
        print("다음은 어떤 단어에 대한 설명일까요? ")
        print("\""+question+"\"")
        Show_words(Problems)
        answer = input("\n답을 입력하세요 : ")    
        if Problems[answer] == question:
            print("정답입니다. !\n")
            chk = True
        else:
            print("정답이 아닙니다.\n")

 

참고풀이 결과]

 

 

 

 

 

대한민국의 아름다운 영토, 독도

 

반응형

댓글