By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,479 Members | 1,241 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,479 IT Pros & Developers. It's quick & easy.

Programming a cipher method using Python

thatos
100+
P: 105
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
Share this Question
Share on Google+
1 Reply

bartonc
Expert 5K+
P: 6,596
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.