blooming8

Crypto 1.0

Jul 21st, 2014
381
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.85 KB | None | 0 0
  1. alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
  2.          'x', 'y' 'z']
  3. crypted = []                                                                # empty string for output
  4.  
  5. word = raw_input('Write below the word or the phrase to code:\n')
  6. for i in range(0, len(word)):                                               # from 0 to word's max length
  7.     if word[i] in alpha:                                                    # if character is in the alphabet
  8.         crypted.append(alpha.index(word[i]) + 1)                            # adds every position in the output
  9.     else:
  10.         print 'error, not found characters'                                 # some kind of error I don't raise
  11. print crypted                                                               # prints the final string
Advertisement
Add Comment
Please, Sign In to add comment