Advertisement
Guest User

Untitled

a guest
Nov 17th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None | 0 0
  1. alphabet = "abcdefghijklmnopqrstuvwxyz"
  2.  
  3. key = 3
  4.  
  5. word = input("Plese enter a char:")
  6. position = alphabet.find(word)
  7. print("Entered position = " + str(position))
  8. encryptedPosition = (position + key) % 26
  9. print("Ecrypted position = " + str(encryptedPosition))
  10. encryptedWord = alphabet[encryptedPosition]
  11. print("Encrypted char = " + encryptedWord)
  12.  
  13. encryptedWord = ""
  14.  
  15. for i in range(len(word)):
  16.     print("Letter - " + word[i] + "index = " +str(i))
  17.     encryptedWord += word[i]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement