If I have list='abcdedcba'
and i want: a=z, b=y, c=x, d=w, e=v so it would translate to:
translate='zyxwvwxya'
How would I do this? If I construct a dictionary
>>> d=dict(zip(('a','b','c','d','e'),('z','y','x','w','v')))
and type
>>> example= d[x] for x in list
>>> print translate
['z', 'y', 'x', 'w', 'v', 'w', 'x', 'y', 'z']
How do I get it back into the form
translate='zyxwvwxyz'
?
the_list = ['z', 'y', 'x', 'w', 'v', 'w', 'x', 'y', 'z']
print "".join(the_list)