[Tutor] Problem with tuple and dictionary
Danny Yoo
dyoo@hkn.eecs.berkeley.edu
Tue, 13 Nov 2001 17:17:00 -0800 (PST)
On Tue, 13 Nov 2001, Steve Howell wrote:
> Mike Yuen wrote:
> >
> > I'm writing a larger program and for some reason, I keep getting an error
> > at the following:
> >
> > matrix[(curr,last)] = int(diff)
>
> What's the error?
>
> >
> > Here's some more code in case the above line isn't the actual problem:
> > def compare (self, last, dict):
> > #
> > # Some other irrelevant stuff here
> > #
> >
> > while (curr < last):
> > dcurr = dict[curr]
> > end = len(dict[last])
> >
> > for index1 in range(end):
> > if dcurr[index1] != dlast[index1]:
> > diff = diff + 1
> > matrix[(curr,last)] = int(diff) #WhAT's UP HERe?
> > curr = curr + 1 #Get next applicable dict entry
> > diff = 0
> > index1 = 0
> >
>
> You probably need to add this line to the method:
>
> global matrix
>
> _______________________________________________
> Tutor maillist - Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>