469,575 Members | 1,658 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,575 developers. It's quick & easy.

Programming a cipher method using Python

thatos
105 100+
I would like to make a code. If I have a letter 'a' must return 'c' and 'd' must return 'f' i.e. must convert each letter of a given word into the third letter from that letter.
Aug 22 '07 #1
1 1106
bartonc
6,596 Expert 4TB
I would like to make a code. If I have a letter 'a' must return 'c' and 'd' must return 'f' i.e. must convert each letter of a given word into the third letter from that letter.
Expand|Select|Wrap|Line Numbers
  1. >>> cypher = dict(a='c', d='f')
  2. >>> "".join([cypher[key] for key in list("ad")])
  3. 'cf'
  4. >>> 
Aug 22 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by Michael Sparks | last post: by
7 posts views Thread by Piotr Turkowski | last post: by
134 posts views Thread by evolnet.regular | last post: by
11 posts views Thread by John Salerno | last post: by
12 posts views Thread by betabrain.honshu | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.