Link Dictionary

anush shetty itsanushshetty at gmail.com
Mon Jun 11 23:20:50 CEST 2007


On Jun 12, 1:50 am, "Gabriel Genellina" <gagsl-... at yahoo.com.ar>
wrote:
> En Mon, 11 Jun 2007 17:24:26 -0300, anush shetty
> <itsanushshe... at gmail.com> escribió:
>
>
>
> > Hi,
> > I have two dictionaries
>
> >  dict1={'B8': set(['I8', 'H8', 'B2', 'B7', 'F8', 'C9', 'G8', 'B4',
> > 'B5', 'B6', 'C8', 'E8', 'D8', 'B3', 'A9', 'A8', 'C7', 'B9', 'A7',
> > 'B1']), 'B9': set(['I9', 'H9', 'A7', 'F9', 'B3', 'B6', 'G9', 'B4',
> > 'B5', 'C9', 'B7', 'E9', 'B1', 'B2', 'D9', 'A9', 'A8', 'C8', 'B8',
> > 'C7']), ...
>
> > and
> > dict2=
> > {'I6': '0', 'H9': '9', 'I2': '0', 'E8': '0', 'H3': '0', 'H7': '0',
> > 'I7': '3', 'I4': '0', 'H5': '0', 'F9': '0', 'G7': '5', 'G6': '9', [...]
> > 'B2': '0', 'B3': '0', 'D6': '2', 'D7': '9', 'D4': '1', 'D5': '0',
> > 'B8': '0', 'B9': '1', 'D1': '0'}
>
> > Now I want to create a dict which would have both the keys and values
> > to be of the corresponding values of dict2.
>
> > Something like this:
>
> > Eg. The first key in dict1 i.e. B8 as 0 (0 is the value of B8 in
> > dict2) mapped as set(['0','0','0',...]).
>
> Sets can't have duplicate elements, so set(['0','0','0'])==set(['0'])
> And dictionaries can't have duplicate keys either.
> What do you want to do exactly? How would your desired structure look like?
>
> --
> Gabriel Genellina

Need it for a verification of the puzzle. It has duplicate values. But
there is any way where i could represent them with duplicates

-
Anush




More information about the Python-list mailing list