On 12/10/2012 5:59 PM, John Gordon wrote:
def encode(plain):
'''Return a substituted version of the plain text.'''
encoded = ''
for ch in plain:
encoded += key[alpha.index(ch)]
return encoded
The turns an O(n) problem into a slow O(n*n) solution. Much better to build a list of chars and then join them.
-- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
