SHARE
TWEET

Insert Random Word

a guest Feb 20th, 2020 98 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. '''
  2.  
  3. Menambahkan kata "gan" secara acak pada suatu kalimat, biar mirip clan haxor slur
  4.  
  5. minimal setiap 4 kata akan disisipkan 1 kata "gan"
  6.  
  7. Made By: FRQNC a.k.a Muhamad Furqon Al-Haqqi
  8. FOLL IG : @frqn_c
  9. '''
  10. import math
  11. import random
  12.  
  13. sentence = input("Kalimat: ").split()
  14.  
  15.  
  16. newSentence = []
  17.  
  18. start = 0
  19.  
  20. insertWord = "gan"
  21.  
  22. #misah kalimat ke dalam list baru, jadi tiap list cuma ada 4 kata
  23. for i in range(int(math.ceil(len(sentence) / 4) + 1)):
  24.     newSentence.append(sentence[start:4*i])
  25.     start = 4*i
  26.  
  27. newSentence.pop(0) #dihapus karena isi di index ini kosong
  28.  
  29. #masukin/menyisipkan kata "gan" ke index random
  30. for i in range(len(newSentence)):
  31.     newSentence[i].insert(random.randint(0,4),insertWord)
  32.  
  33. #output
  34. for i in range(len(newSentence)):
  35.     for j in newSentence[i]:
  36.         print(j,end=" ")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top