Guest User

Untitled

a guest
Jan 18th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. """
  2. Substitutes original text by finding all characters in original, and substituting by its position analog in substitution
  3. substituteText("Substitute this", "SseIih", "553114")
  4. '5ub5t1tut3 t415'
  5. """
  6. def substituteText(original_text, original, substitution):
  7. output_text = list(original_text)
  8.  
  9. index = 0
  10. for character in original_text:
  11. if character in original:
  12. output_text[index] = substitution[original.find(character)]
  13. index += 1
  14.  
  15. return "".join(output_text)
Add Comment
Please, Sign In to add comment