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?
clouds_n_things
13
Junior Poster in Training
Recommended Answers
Jump to PostI 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]
Jump to PostThe "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 …
All 6 Replies
rrashkin
41
Junior Poster in Training
clouds_n_things
13
Junior Poster in Training
clouds_n_things
13
Junior Poster in Training
rrashkin
41
Junior Poster in Training
woooee
814
Nearly a Posting Maven
clouds_n_things
13
Junior Poster in Training
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.