Advertisement
DevastatingRPG

Untitled

Sep 17th, 2020
946
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.05 KB | None | 0 0
  1. import pyperclip
  2.  
  3.  
  4. def roach(words):
  5.  
  6.     string_new = ''
  7.     new_sentence = []
  8.     for section in words:
  9.  
  10.         if 'brother' in section.lower() or section.isdigit():
  11.             new_sentence.append(section)
  12.             continue
  13.  
  14.         added = False
  15.         for char in special_char:
  16.             if char in section:
  17.                 new_sentence.append(section[:section.index(char)] + 'roach' + char)
  18.                 added = True
  19.                 break
  20.  
  21.         if not added:
  22.             new_sentence.append(section + 'roach')
  23.         continue
  24.  
  25.     for word in new_sentence:
  26.         string_new += word + ' '
  27.     pyperclip.copy(string_new)
  28.     print('')
  29.  
  30.  
  31. if __name__ == '__main__':
  32.     while True:
  33.         string = input("What should I convert into Roachanese ? (Enter 'stopbrother' to exit): ")
  34.         if string.lower() == 'stopbrother':
  35.             break
  36.         special_char = ['.', ',', ';', ':', '-', '_', '\'', '\"', '?', '!', '$', '%', '&', '*', '(', ')', '/', '\\']
  37.         sections = string.split(' ')
  38.         roach(sections)
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement