[Tutor] Dictionaries - Using 1 Key:Value to find another

David bouncingcats at gmail.com
Sun Dec 12 01:34:52 CET 2010


On 12 December 2010 11:10, Al Stern <albstern at gmail.com> wrote:
>
> I thought father got defined in the
>
> father == pairs[grandfather]
> line.  I have tried it a couple different ways but always get the father is
> not defined error once I enter the name.

I only glanced at your code, but maybe you have some typos there:

            father == pairs[grandfather]
            for father in pairs:
                grandson == pairs[father]

should probably be
            father = pairs[grandfather]
            for father in pairs:
                grandson = pairs[father]

Try that.


More information about the Tutor mailing list