Advertisement
Guest User

Untitled

a guest
Dec 7th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. # lowercase alphabet has the values of 97 - 122
  2. if (ord(char) >= 97) and (ord(char) <= 122):
  3. return chr(97 + (alphabet_position(char) + rot) % 26)
  4.  
  5. # uppercase alphabet has the values of 65 - 90
  6. elif (ord(char) >= 65) and (ord(char) <= 90):
  7. return chr(65 + (alphabet_position(char) + rot) % 26)
  8.  
  9. else:
  10. # If not a letter, this will return the exact character
  11. return char
  12.  
  13. # lowercase alphabet has the values of 97 - 122
  14. if (ord(letter) >= 97) and (ord(letter) <= 122):
  15. return ord(letter) - 97
  16.  
  17. # uppercase alphabet has the values of 65 - 90
  18. elif (ord(letter) >= 65) and (ord(letter) <= 90):
  19. return ord(letter) - 65
  20.  
  21. else:
  22. pass
  23.  
  24. text_new = ""
  25.  
  26. for pos in range(len(text)):
  27. text_new += rotate_character(text[pos], int(rot))
  28. return text_new
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement