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):
- return str(x) == str(x)[::-1]
- 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