# Arup Guha
# Basic Address Book
# 9/23/2019

def main():

    phonebook = {}

    # Give user some options.
    print("Please choose an option.")
    print("1. Add/Change a number.")
    print("2. Delete someone's number.")
    print("3. Look up a number.")
    print("4. Quit.")
    choice = int(input(""))

    # Main Program Loop
    while choice != 4:

        # Add a name.
        if choice == 1:

            # Get info and then edit dictionary.
            name = input("Who's number are you adding/changing?\n")
            num = int(input("What is their number, digits only\n"))
            phonebook[name] = num

        # Get rid of someone!
        elif choice == 2:

            # Get name to delete.
            name = input("Who's number do you want to delete?\n")

            # It's here, get rid of it.
            if name in phonebook:
                del phonebook[name]

            # Error message.
            else:
                print("Good news, you didn't have their number to begin with!")

        # Look up a number.
        elif choice == 3:

            # Get name to delete.
            name = input("Who's number do you want?\n")

            # It's here, answer the query.
            if name in phonebook:
                print("The number for",name,"is",phonebook[name])

            # Error message.
            else:
                print("Sorry, this number isn't stored.")

        # Error message for a bad choice.
        elif choice != 4:
            print("Sorry that was an invalid option.")

        # Get the next choice.
        print("Please choose an option.")
        print("1. Add/Change a number.")
        print("2. Delete someone's number.")
        print("3. Look up a number.")
        print("4. Quit.")
        choice = int(input(""))

    # Ending message.
    print("Thank you for using our address book!")

main()
