Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from yandex_testing_lesson import is_palindrome
- import random
- class PalindromesClass:
- def __init__(self):
- self.chcount = 0
- self.palindromes = []
- self.count = 0
- self.n = str(self.count)
- def check_palindromes(self):
- self.not_pals = 0
- for _ in range(10000):
- if not is_palindrome("".join([str(x) for x in range(random.randint(2, 5))])):
- self.not_pals += 1
- print("+1 pals")
- if self.not_pals == 10000:
- self.chcount += 1
- print("+1 chc")
- while self.count < 10000:
- if self.n == self.n[::-1] is True:
- self.palindromes.append(self.n)
- self.count += 1
- else:
- self.count += 1
- print(self.palindromes)
- if all(is_palindrome(pal) for pal in self.palindromes):
- self.chcount += 1
- print("+1 chc")
- return self.chcount
- if __name__ == "__main__":
- print("YES" if PalindromesClass.check_palindromes == 2 else "NO")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement