Expand|Select|Wrap|Line Numbers
- import string
- codedsen = ""
- idxlower = "abcdefghijklmnopqrstuvwxyz"
- sen = raw_input ("Please enter a phrase to encode")
- key = raw_input ("Please enter a key number")
- print sen
- for symbol in sen:
- if symbol is idxlower:
- chidx = idxlower.find(ch) + int(key)
- if chidx > 25:
- chidx = chidx - 26
- elif chidx < 0:
- chidx = chidx + 26
- else:
- chidx = symbol
- newch = idxlower[chidx] <<<< I get an error message
- codedsen = codedsen + newch
- print "Your coded phrase is", codedsen