Im writing an address book to use from terminal, how would I return the users contact info from the end-users input from the dictionary I created?

I would need more information to answer that. What is the structure of the dictionary? Normally, I would key an address book on "name" so something like AddBook={"john doe":("8134789 Zubruzlechester", "Alpha Centauri", "999-555-1234")}. In that case I would get the telephone number, for instance, for John Doe, as: AddBook["john doe"][2]

Thanks for the reply rrashkin! My address book so far is formatted as such:

ab = {      'Kai'               : 'Phone Number: (555)-123-3120 or Email: something1@icloud.com', 
            'Anna'              : 'Phone Number: (555)-123-5385 or Email: something2@yahoo.com',
            'Donya'             : 'Phone Number: (555)-123-4161 or Email: something3@cs.com',
            'Elizabeth'         : 'Phone Number: (555)-123-8474 or Email: something4@yahoo.com', 
            'Derrick'           : 'Phone Number: (555)-123-3628 or Email: something5@instagram.com',
            'Ruth'              : 'Phone Number: (555)-123-8620 or Email: something6@instagram.com',
            'Nicole'            : 'Phone Number: (555) 123-3085 or Email: something7@gmail.com',

}


def in_addressbook(text):
    return key

key = input('Enter a contact information here: ')
if in_addressbook(key):
    print ('This contacts information is: {0}'.format(ab:0))

The formatting for Derrick, Ruth, and Nicole are all temporary, but they should be formatted like the rest instead of their email taking on a new line. System kind of messed it up lol.

So what's the question? The keys are names and the values are strings.

The "in" operater is used to look up a key in a dictionary --> dictionary tutorial http://www.greenteapress.com/thinkpython/html/thinkpython012.html Note rrashkin's advice above and store each item in a string or as an element of a sub-list so you can access them individually as (s)he has done. You should not post real phone numbers or e-mail addresses on a public forum.

key = input('Enter a contact information here: ')
if key in ab:
    print (ab[key])
else:
    print("name not found")

Awesome, yeah I totally was not even paying attention when I posted my ab, (where the heck is my head at?), thanks for the advice everyone!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.