Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #1)
- def summ_in_list(n):
- j = sum(int(x) for x in n)
- return j
- a = [int(x) for x in input().split()]
- print(summ_in_list(a))
- #Ответ:77
- #2)
- def find_diop(n):
- if int(input()) <=n <= int(input()):
- return True
- else:
- return False
- print(find_diop(int(input())))
- #Ответ: True
- #3)
- def find_div(n):
- a = []
- for i in range(1,n):
- if n % i == 0:
- a.append(i)
- print(a)
- if sum(a) == n:
- return True
- else:
- return False
- print(find_div(int(input())))
- #Ответ:True
- #4)
- def is_palindrom(n):
- s = str(n)
- if s == s[::-1]:
- return True
- else:
- return False
- print(is_palindrom(int(input())))
- #Ответ: False
- #5)
- def is_prime(n):
- for i in range(2,int(n ** 0.5)+1):
- if n % i == 0:
- return False
- return True
- print(is_prime(int(input())))
- #Ответ: False
- #6)
- def f(n):
- if n == 1:
- return 0
- if n == 2:
- return 1
- if n == 3:
- return 1
- if n > 3:
- return f(n-1) + f(n-2)
- print(f(10))
- #Ответ: 34
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement