On Mon, Sep 8, 2008 at 8:37 AM, John Machin <[EMAIL PROTECTED]> wrote: > Is this homework?
I hope it's not - or I'll be quite annoyed :) > There seems to be an implicit assumption in the answers so far that > your mapping is a 1:1 mapping of all possible input keys. > > If it doesn't include all possible input keys, answers will crash with > a KeyError. If there are any many:1 elements in the mapping (for > example, {'a': 'A', 'b': 'A'}), lossage happens. You may wish to code > in some checks for this. You are quite right! But then he/she didn't ask for this right ? :) cheers James -- -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list