Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- def begin1(a):
- return 4*a
- def begin2(a):
- return a * a
- def begin3(a,b):
- return a*b, 2*(a + b)
- def begin4(d):
- return d*3.14
- def begin5(a):
- return a*a*a, 6*a*a
- def begin6(a, b, c):
- return a*b*c, 2*(a*b + b*c + a*c)
- def begin7(r):
- return 6.28*r, 3.14*(r*r)
- def begin8(a, b):
- return (a+b)/2
- def begin9(a, b):
- return math.sqrt(a*b)
- def begin10(num1, num2):
- return num1+num2, num1-num2, num1*num2, math.sqrt(num1)/math.sqrt(num2)
- def begin11(num1, num2):
- return num1+num2, num1-num2, num1*num2, abs(num1)/abs(num2)
- def begin12(a, b):
- c = math.sqrt(a*a + b*b)
- return c, a+b+c
- def begin13(r1, r2):
- s1 = 3.14*(r1*r1)
- s2 = 3.14*(r2*r2)
- s3 = abs(s1-s2)
- return s1,s2,s3
- def begin14(l):
- r = l/6.18
- s = 3.14*(r*r)
- return r,s
- def begin15(s):
- d = math.sqrt(s/3.14)*2
- l = 3.14*d
- return d,l
- def begin16(x1,x2):
- return abs(x1-x2)
- def begin17(a, b, c):
- longac = abs(a-c)
- longbc = abs(b-c)
- return longac, longbc, longac+longbc
- def begin18(a, b, c):
- longac = abs(a-c)
- longbc = abs(b-c)
- return longac*longbc
- def begin19(x1, y1, x2, y2):
- sideup = abs(x2-x1)
- sideleft = abs(y2-y1)
- return 2*sideup + 2*sideleft, sideup*sideleft
- def begin20(x1, x2, y1, y2):
- return math.sqrt(abs(x2-x1)*abs(x2-x1) + abs(y2-y1)*abs(y2-y1))
- def begin21(x1, y1, x2, y2, x3, y3):
- a = begin20(x1, x2, y1, y2)
- b = begin20(x2, x3, y2, y3)
- c = begin20(x1, x3, y1, y3)
- p = (a + b + c) / 2
- return math.sqrt(p*(p-a)*(p-b)*(p-c))
- def begin22(a, b):
- return b, a
- def begin23(a, b, c):
- return b, c, a
- def begin25(x):
- return 3*(math.pow(x, 6))-6*(x*x)-7
- def begin30(a):
- return a*(180/3.14)
- def begin35(v, u, t1, t2):
- return (v*t1) + (v-u)*t2
- def begin40(a1, b1, c1, a2, b2, c2):
- d = (a1 * b2) - (a2 * b1)
- x = (c1 * b2 - c2 * b1) / d
- y = (a1 * c2 - a2 * c1) / d
- return x, y
- def integer1(l):
- return int(l/100)
- def integer5(a, b):
- return a%b
- def integer10(num):
- return int(str(num)[-1]), int(str(num)[-2])
- def integer15(num):
- return int(str(num)[1] + str(num)[0] + str(num)[-1])
- def integer20(n):
- return int(n%3600)
- def integer25(k):
- return (k%7)-1
- def integer30(year):
- if year%100 == 0:
- return year/100
- return year/100 + 1
- def boolean1(a):
- if a >= 0:
- return True
- return False
- def boolean5(a, b):
- if a >= 0 or b < -2:
- return True
- return False
- def boolean10(a, b):
- if a+b % 2 != 0:
- return True
- return False
- def boolean15(a, b, c):
- more = 0
- if a > 0:
- more += 1
- if b > 0:
- more += 1
- if c > 0:
- more += 1
- if more == 2:
- return True
- return False
- def boolean20(num):
- num = str(num)
- if num[0] != num[1] and num[0] != num[2] and num[1] != num[2]:
- return True
- return False
- def boolean25(x, y):
- if x > 0 and y > 0:
- return True
- return False
- def boolean30(a, b, c):
- if a == b == c:
- return True
- return False
- def boolean35(x1, y1, x2, y2):
- if x1+y1 % 2 == x2+y2 % 2:
- return True
- return False
- def boolean40(x1, y1, x2, y2):
- if abs((x1+y1)-(x2+y2)) in [3, 1, 2, 4]:
- return True
- return False
- def if1(num):
- if num > 0:
- return num+1
- return num
- def if5(num1, num2, num3):
- all = [num1, num2, num3]
- more = 0
- less = 0
- for i in all:
- if i >= 0:
- more+=1
- else:
- less+=1
- return more, less
- def if10(a, b):
- if a != b:
- return a+b, a+b
- return 0, 0
- def if15(num1, num2, num3):
- all = [num1, num2, num3]
- all.remove(max(num1, num2, num3))
- all.remove(min(num1, num2, num3))
- return max(num1, num2, num3) + all[0]
- def if20(a, b, c):
- #points = {a: 'a', b: 'b', c: 'c'}
- #return points[min(b-a, c-a)+a], min(b-a, c-a)
- return min(b-a, c-a)+a, min(b-a, c-a)
- def if25(x):
- if x < -2 and x > 2:
- return x * 2
- else:
- return -3 * x
- def if30(num):
- two = {True: 'нечетное ', False: 'четное '}
- onetwo = {1: 'однозначное', 2: 'двухзначное', 3: 'трехзначное'}
- return two[num%2] + onetwo[len(str(num))]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement