472,145 Members | 1,401 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,145 software developers and data experts.

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 1143
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 Saiars | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.