여기 내 미완성 전화 번호부가 있습니다. 사람들이 사전에서 사람들을 검색, 추가 및 제거 할 수 있기를 바랍니다. remove 함수를 아직 추가하지 않았지만 키워드를 통해 요청할 때이 스크립트를 다시 시작하는 방법은 무엇입니까? (예 : 다른 기능을 수행 하시겠습니까? [Y/N])이 사전을 반복하는 방법?
그렇다면 각 기능 (또는 명령문)을 처음부터 다시 시작하려면 어떻게해야합니까?
details = {"Toby": "123", "James": "234", "Paul": "345"}
print("Welcome To The Telephone Directory.\n")
print("To search out specific details, please type Search.\n To add a new person to the Directory, type Add.\n To change someone's details, please type Edit.")
inputKey = input();
if(input() == inputKey.strip() in "search Search SEARCH".split()):
print("Please enter the name of the customer.")
customer = input()
print("Number:" ,details.get(customer))
if(customer not in details):
print("I'm sorry, but the person you defined is not in the directory.")
elif(input() == inputKey.strip() in "add Add ADD AdD aDD".split()):
print("Please enter the full name of the person you would like to add to the directory.")
addedcustomer = input()
print("Now, please enter their number.")
addednumber = int(input())
details.add [addedcustomer : addednumber]
print(details)
나는 당신이이 태그 할 때 당신이 당신의 자신의 질문에 대답 생각'사용자가 선택한 옵션이 "N"루프가없는 동안 – Harrison
는, while 루프를 사용 loops'. –