[Tutor] python dictionaries

Alan Gauld alan.gauld at btinternet.com
Sat Jan 6 01:25:57 CET 2007

"Raven Of Night Raven Of Night" <raistlen117 at msn.com> wrote

> I don't understand, dictionarys only allow two elements so how can 
> you
> include several generations in the dictinoary...

Grandfather -> Father -> Son

can be expressed as two pairs:

Grandfather -> Father
Father -> Son

Now you can put it in your dictionary.

You only need to figure out how to join the pairs back into
a triple again...

> could you perhaps put a dictinoary inside a dictionary?

You can, but you don;t need to. And, assuming its a homework,
I don't think thats what you are expected to do here.


Alan Gauld
Author of the Learn to Program web site

More information about the Tutor mailing list