Advertisement
Guest User

Untitled

a guest
Feb 19th, 2020
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. from yandex_testing_lesson import is_palindrome
  2. import random
  3.  
  4.  
  5. class PalindromesClass:
  6. def __init__(self):
  7. self.chcount = 0
  8. self.palindromes = []
  9. self.count = 0
  10. self.n = str(self.count)
  11.  
  12. def check_palindromes(self):
  13. self.not_pals = 0
  14. for _ in range(10000):
  15. if not is_palindrome("".join([str(x) for x in range(random.randint(2, 5))])):
  16. self.not_pals += 1
  17. print("+1 pals")
  18.  
  19. if self.not_pals == 10000:
  20. self.chcount += 1
  21. print("+1 chc")
  22.  
  23. while self.count < 10000:
  24. if self.n == self.n[::-1] is True:
  25. self.palindromes.append(self.n)
  26. self.count += 1
  27. else:
  28. self.count += 1
  29. print(self.palindromes)
  30. if all(is_palindrome(pal) for pal in self.palindromes):
  31. self.chcount += 1
  32. print("+1 chc")
  33.  
  34. return self.chcount
  35.  
  36.  
  37. if __name__ == "__main__":
  38. print("YES" if PalindromesClass.check_palindromes == 2 else "NO")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement