Do you know about Python dictionaries?
http://docs.python.org/tutorial/datastructures.html#dictionaries
They're a kind of general map along the lines that you want, and you
can build them in many ways. For example:
import string
m = dict((c, ord(c.lower())-ord('a')+17) for c in string.ascii_letters)
print m['A'], m['a']
or
indices = range(5, 26+5)
m2 = dict(zip(string.ascii_lowercase, indices))
print m2['a'], m2['z']
or you can build one manually:
m3 = {'a': 5, 'b': 238}
print m3['a'], m3['b']
Doug
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org