# A program that implements a rudimentary phone catalog: # - Asks the user to enter enter names and phone numbers. # - Enters in a loop where the user enters a name and the # program looks up and prints out the corresponding phone number. # initialize lists that will store names and phone numbers # convention: the programmer will make sure that numbers[i] stores # the phone number for names[i]. names = [] numbers = [] # get from the user the names and phone numbers. while True: name = input("enter a name: ") if (name == "q") or (name == "quit"): break number = input("enter a phone number for " + name + ": ") names.append(name) numbers.append(number) print() # now, get in a loop where the user enters a name, and the computer # looks up and prints out the corresponding phone number. while True: name = input("enter a name to look up: ") if (name == "q") or (name == "quit"): break for i in range(0, len(names)): if name == names[i]: print("the phone number of", name, "is", numbers[i], "\n")