Guest User

Untitled

a guest
Aug 15th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. list_A="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
  2. list_a=list_A.lower()
  3. list_0="0123456789"
  4.  
  5. def rot_a(c,k):
  6. if list_A.find(c) >=0:
  7. list= list_A
  8. elif list_a.find(c) >=0:
  9. list= list_a
  10. elif list_0.find(c) >=0:
  11. list= list_0
  12. else:
  13. return c
  14.  
  15. l = len(list)
  16. position = list.find(c)
  17. p= (position + k) % l
  18. return list[p]
  19.  
  20. def rot(c,k):
  21. l=len(c)
  22. p=""
  23. for i in range(l):
  24. p+=rot_a(c[i],k)
  25. return p
Add Comment
Please, Sign In to add comment