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’
?
1 Answer