Guest User

Untitled

a guest
Feb 24th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. choice = input("Would you like to encode or decode?")
  2. shiftValue = 4
  3.  
  4. def Encoder():
  5. secretMsg = input("What message would you like to encode?")
  6. for char in secretMsg:
  7. x = ord(char)
  8. x += shiftValue
  9. x = chr(x)
  10. print(x, end="")
  11.  
  12.  
  13. def Decoder():
  14. secretMsg = input("What message would you like to decode?")
  15. for char in secretMsg:
  16. x = ord(char)
  17. x -= shiftValue
  18. x = chr(x)
  19. print(x, end="")
  20.  
  21. def Choose(choice):
  22.  
  23. if (choice == "Encode" or "encode"):
  24. Encoder()
  25. elif(choice == "Decode" or "decode"):
  26. Decoder()
  27. else:
  28. print("Error: Please input either encode or decode.")
  29.  
  30. Choose(choice)
Add Comment
Please, Sign In to add comment