Advertisement
Guest User

Untitled

a guest
Jan 18th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. import string
  2. import random
  3. import time
  4.  
  5. possibleCharacters = string.ascii_lowercase + string.digits + string.ascii_uppercase + ' .,!?;:='
  6.  
  7. def programeed():
  8. target = input("Please enter some text (any text and some symbols): ")
  9. attemptThis = ''.join(random.choice(possibleCharacters) for i in range(len(target)))
  10. attemptNext = ''
  11.  
  12. completed = False
  13.  
  14. tries = 0
  15. while completed == False:
  16. print(attemptThis)
  17. attemptNext = ''
  18. completed = True
  19. for i in range(len(target)):
  20. if attemptThis[i] != target[i]:
  21. completed = False
  22. attemptNext += random.choice(possibleCharacters)
  23. else:
  24. attemptNext += target[i]
  25. tries += 1
  26. attemptThis = attemptNext
  27. print(tries,"tries")
  28.  
  29. while True:
  30. programeed()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement