[Tutor] Accessing a tuple element

Mike Yuen myuen@ucalgary.ca
Fri, 16 Nov 2001 21:32:05 -0700 (MST)


I have a question regarding accessing a tuple within a dictionary.
I've got a whole bunch of points on a matrix inside a dictionary as
follows:
dict {(1, 2): 4, (8, 11): 2, etc etc}
My question is, I would like to access the first and occasionally the
second element of the tuples.

I know I can access a tuple element simply by indexing into it but it
doesn't seem to work if a tuple is a dictionary key.
Does anyone know if there's a way to do this?

Thanks,
M