Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- def dali_e_prost(x):
- for i in range(2, int(math.sqrt(x) + 1)):
- if x % i == 0:
- return False
- return True
- def e_palindrom(x):
- s = str(x)
- if s == s[::-1]:
- return True
- return False
- def main():
- n = int(input())
- niza = []
- for i in range(0, n):
- x = int(input())
- niza.append(x)
- prosti = 0
- slozheni = 0
- palindromi = 0
- for i in range(0, n):
- if dali_e_prost(niza[i]):
- prosti += 1
- else:
- slozheni += 1
- if e_palindrom(niza[i]):
- palindromi += 1
- print(f"Prosti: {prosti}")
- print(f"Slozheni: {slozheni}")
- print(f"Palindromi: {palindromi}")
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement