Guest User

Untitled

a guest
Jul 21st, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #!/usr/bin/env python
  2. from random import shuffle
  3.  
  4. def wierdspell(correct):
  5. """this fucks up text"""
  6.  
  7. lines = []
  8. for line in correct.splitlines():
  9.  
  10. wrong = []
  11. for word in line.split(' '):
  12. if len(word) == 0: continue
  13. word = list(word)
  14. first, last = word[0], word[-1]
  15. mix = word[1:-1]
  16. shuffle(mix)
  17. wrong.append(first + ''.join(mix) + last)
  18.  
  19. lines.append(' '.join(wrong))
  20.  
  21. return '\n'.join(lines)
  22.  
  23.  
  24. if __name__ == "__main__":
  25. from sys import stdin, stdout
  26.  
  27. inp = stdin.read()
  28. outp = wierdspell(inp)
  29. stdout.write(outp)
Add Comment
Please, Sign In to add comment