Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. code = input("enter coded text: ")
  2. distance = int(input("enter value: "))
  3. plainText = ""
  4. for ch in code:
  5. ordvalue = ord(ch)
  6. ciphervalue = ordvalue - distance
  7. if ciphervalue < ord('a'):
  8. ciphervalue = ord('z') -
  9. (distance - (ord('a')-ordvalue - 1))
  10. plainText += chr(ciphervalue)
  11. print(plainText)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement