1

I've got a problem in a small programming exercise, in which I should create a mutable 'phone book' from a dictionary embedded into another. One problem with the exercise is that I have to create a structure with several dicts, like this: {Name: Smith first name: Michael Phone Number: 2345

Name: Miller first name: Tom}

While I can search for the Name Part and thus add something to the entry for Miller.

I understand that I can embed dicts as a value to a key with

    dict1['dict2']

but this doesn't seem to work how it should. Can you give me an example how I can write this?

Yama994
  • 29
  • 1
  • 3
  • It sounds like you need to decide what the key on the outer dict will be, i.e. how do you want to look up the info for `Tom Miller`? – theorifice Nov 29 '16 at 16:48
  • Refer to this answer it should clear somethings up for you. http://stackoverflow.com/a/16333441/2062443 – Persiden Nov 29 '16 at 16:50
  • @theorifice The Problem is that there seems to be a Key and a value before the inner dict starts – Yama994 Nov 29 '16 at 16:56

0 Answers0