fork download
  1. def encrypt(text, n):
  2. count = 0
  3.  
  4. while count != n:
  5. text = text[1::2] + text[::2]
  6. count += 1
  7.  
  8. return text
  9.  
  10. s = "This is a test!"
  11. print encrypt(s, 0) == s
Success #stdin #stdout 0s 9024KB
stdin
Standard input is empty
stdout
True