Advertisement
Guest User

Untitled

a guest
Jul 31st, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. print "input:"
  2. inp = raw_input()
  3.  
  4. length = len(inp)
  5.  
  6. realKey = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
  7. subKey = ["D","T","X","C","U","I","Q","V","M","R","W","F","Z","G","P","L","H","A","O","Y","K","N","E","B","S","J"]
  8.  
  9. def subsCipher():
  10. out=""
  11. i=0
  12. while i < length:
  13. decVal = ord(inp[i])
  14. if decVal>=65 and decVal<=90:
  15. j=0
  16. while j<26:
  17. if inp[i]==subKey[j]:
  18. break;
  19. j+=1
  20. out += realKey[j]
  21. else:
  22. out += inp[i]
  23. i+=1
  24. return out
  25.  
  26. outp = subsCipher()
  27. print outp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement