Advertisement
basbasbas

Untitled

Oct 5th, 2021
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.41 KB | None | 0 0
  1. import math
  2.  
  3. def begin1(a):
  4. return 4*a
  5.  
  6. def begin2(a):
  7. return a * a
  8.  
  9. def begin3(a,b):
  10. return a*b, 2*(a + b)
  11.  
  12. def begin4(d):
  13. return d*3.14
  14.  
  15. def begin5(a):
  16. return a*a*a, 6*a*a
  17.  
  18. def begin6(a, b, c):
  19. return a*b*c, 2*(a*b + b*c + a*c)
  20.  
  21. def begin7(r):
  22. return 6.28*r, 3.14*(r*r)
  23.  
  24. def begin8(a, b):
  25. return (a+b)/2
  26.  
  27. def begin9(a, b):
  28. return math.sqrt(a*b)
  29.  
  30. def begin10(num1, num2):
  31. return num1+num2, num1-num2, num1*num2, math.sqrt(num1)/math.sqrt(num2)
  32.  
  33. def begin11(num1, num2):
  34. return num1+num2, num1-num2, num1*num2, abs(num1)/abs(num2)
  35.  
  36. def begin12(a, b):
  37. c = math.sqrt(a*a + b*b)
  38. return c, a+b+c
  39.  
  40. def begin13(r1, r2):
  41. s1 = 3.14*(r1*r1)
  42. s2 = 3.14*(r2*r2)
  43. s3 = abs(s1-s2)
  44.  
  45. return s1,s2,s3
  46.  
  47. def begin14(l):
  48. r = l/6.18
  49. s = 3.14*(r*r)
  50.  
  51. return r,s
  52.  
  53. def begin15(s):
  54. d = math.sqrt(s/3.14)*2
  55. l = 3.14*d
  56.  
  57. return d,l
  58.  
  59. def begin16(x1,x2):
  60. return abs(x1-x2)
  61.  
  62. def begin17(a, b, c):
  63. longac = abs(a-c)
  64. longbc = abs(b-c)
  65.  
  66. return longac, longbc, longac+longbc
  67.  
  68. def begin18(a, b, c):
  69. longac = abs(a-c)
  70. longbc = abs(b-c)
  71.  
  72. return longac*longbc
  73.  
  74. def begin19(x1, y1, x2, y2):
  75. sideup = abs(x2-x1)
  76. sideleft = abs(y2-y1)
  77.  
  78. return 2*sideup + 2*sideleft, sideup*sideleft
  79.  
  80. def begin20(x1, x2, y1, y2):
  81. return math.sqrt(abs(x2-x1)*abs(x2-x1) + abs(y2-y1)*abs(y2-y1))
  82.  
  83. def begin21(x1, y1, x2, y2, x3, y3):
  84. a = begin20(x1, x2, y1, y2)
  85. b = begin20(x2, x3, y2, y3)
  86. c = begin20(x1, x3, y1, y3)
  87. p = (a + b + c) / 2
  88.  
  89. return math.sqrt(p*(p-a)*(p-b)*(p-c))
  90.  
  91. def begin22(a, b):
  92. return b, a
  93.  
  94. def begin23(a, b, c):
  95. return b, c, a
  96.  
  97. def begin25(x):
  98. return 3*(math.pow(x, 6))-6*(x*x)-7
  99.  
  100. def begin30(a):
  101. return a*(180/3.14)
  102.  
  103. def begin35(v, u, t1, t2):
  104. return (v*t1) + (v-u)*t2
  105.  
  106. def begin40(a1, b1, c1, a2, b2, c2):
  107. d = (a1 * b2) - (a2 * b1)
  108.  
  109. x = (c1 * b2 - c2 * b1) / d
  110. y = (a1 * c2 - a2 * c1) / d
  111.  
  112. return x, y
  113.  
  114. def integer1(l):
  115. return int(l/100)
  116.  
  117. def integer5(a, b):
  118. return a%b
  119.  
  120. def integer10(num):
  121. return int(str(num)[-1]), int(str(num)[-2])
  122.  
  123. def integer15(num):
  124. return int(str(num)[1] + str(num)[0] + str(num)[-1])
  125.  
  126. def integer20(n):
  127. return int(n%3600)
  128.  
  129. def integer25(k):
  130. return (k%7)-1
  131.  
  132. def integer30(year):
  133. if year%100 == 0:
  134. return year/100
  135. return year/100 + 1
  136.  
  137. def boolean1(a):
  138. if a >= 0:
  139. return True
  140. return False
  141.  
  142. def boolean5(a, b):
  143. if a >= 0 or b < -2:
  144. return True
  145. return False
  146.  
  147. def boolean10(a, b):
  148. if a+b % 2 != 0:
  149. return True
  150. return False
  151.  
  152. def boolean15(a, b, c):
  153. more = 0
  154. if a > 0:
  155. more += 1
  156. if b > 0:
  157. more += 1
  158. if c > 0:
  159. more += 1
  160.  
  161. if more == 2:
  162. return True
  163. return False
  164.  
  165. def boolean20(num):
  166. num = str(num)
  167. if num[0] != num[1] and num[0] != num[2] and num[1] != num[2]:
  168. return True
  169. return False
  170.  
  171. def boolean25(x, y):
  172. if x > 0 and y > 0:
  173. return True
  174. return False
  175.  
  176. def boolean30(a, b, c):
  177. if a == b == c:
  178. return True
  179. return False
  180.  
  181. def boolean35(x1, y1, x2, y2):
  182. if x1+y1 % 2 == x2+y2 % 2:
  183. return True
  184. return False
  185.  
  186. def boolean40(x1, y1, x2, y2):
  187. if abs((x1+y1)-(x2+y2)) in [3, 1, 2, 4]:
  188. return True
  189. return False
  190.  
  191. def if1(num):
  192. if num > 0:
  193. return num+1
  194. return num
  195.  
  196. def if5(num1, num2, num3):
  197. all = [num1, num2, num3]
  198. more = 0
  199. less = 0
  200. for i in all:
  201. if i >= 0:
  202. more+=1
  203. else:
  204. less+=1
  205.  
  206. return more, less
  207.  
  208. def if10(a, b):
  209. if a != b:
  210. return a+b, a+b
  211. return 0, 0
  212.  
  213. def if15(num1, num2, num3):
  214. all = [num1, num2, num3]
  215. all.remove(max(num1, num2, num3))
  216. all.remove(min(num1, num2, num3))
  217.  
  218. return max(num1, num2, num3) + all[0]
  219.  
  220. def if20(a, b, c):
  221.  
  222. #points = {a: 'a', b: 'b', c: 'c'}
  223. #return points[min(b-a, c-a)+a], min(b-a, c-a)
  224.  
  225. return min(b-a, c-a)+a, min(b-a, c-a)
  226.  
  227. def if25(x):
  228. if x < -2 and x > 2:
  229. return x * 2
  230. else:
  231. return -3 * x
  232.  
  233. def if30(num):
  234. two = {True: 'нечетное ', False: 'четное '}
  235. onetwo = {1: 'однозначное', 2: 'двухзначное', 3: 'трехзначное'}
  236.  
  237. return two[num%2] + onetwo[len(str(num))]
  238.  
  239.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement