# How to use hypot method in autotest

Best Python code snippet using autotest_python

pythagoras.py

Source:pythagoras.py

```12import math 3from math import sqrt45class Pythagoras:6 def __init__(self):7 super().__init__()89 print("\n\n\n\n\n\n\n-----------------------------------------------------------------ð° Welcome To Pythagoras Theromð°----------------------------------------------------------------\n")10 print("â¤ï¸ Here You Can Get Your Answers About - Pythagoras Therom ! â¤ï¸\n")11 print("â ï¸ â ï¸ â ï¸ If You Dont Have Any Value - Set It 0 â ï¸ â ï¸ â ï¸\n ")12 print("â¤ï¸ Formula ----> (Hypotenius)Â² = (Base)Â² + (Height)Â²\n")13 print("â¤ï¸ Try To Use Pythagoras Triads !\n")14 print("\n------------------------------------------------------------------------------------------------------------------------------------------------------------------\n")15 16 def inputs_work():1718 while True :19 try :20 print("â ï¸ If You Want To Quit Enter - Ctrl + C - ð°")21 print("\n------------------------------------------------------------------------------------------------------------------------------------------------------------------") 2223 hypot = int(input("\nâ¡ Enter Hypotenius : ---> "))24 base = int(input("\nâ¡ Enter Base : ---> "))25 height = int(input("\nâ¡ Enter Height : ---> "))2627 break2829 except Exception as e :30 print("\n------------------------------------------------------------------------------------------------------------------------------------------------------------------") 31 print("\n Please Enter Number Only . If You Dont Have Any Value - Set It 0 \n")32 33 except KeyboardInterrupt as f :34 35 print(" ")36 print("\n------------------------------------------------------------------------------------------------------------------------------------------------------------------") 37 print("") 38 print(" â¤ï¸ Ok - Quiting ! \n")39 print("------------------------------------------------------------------------------------------------------------------------------------------------------------------\n") 4041 exit()4243 print("\n------------------------------------------------------------------------------------------------------------------------------------------------------------------") 44 45 if hypot == 0 | base == 0 | height == 0 or hypot == 0 | base == 0 or hypot == 0 | height == 0 or base == 0 | height == 0 :46 print("\n Don't Make Me A Fool ! ð - Because - You Think You Are Bad , But I am Your Dad ð ")4748 elif hypot == 0 :49 hypot = int(base) * int(base) + int(height) * int(height)50 print("")51 print(f"â¡ï¸ Hypotenius = {int(base)} Â² + {int(height)} Â² \n")52 print(f"â¡ï¸ Hypotenius = {int(base) * int(base)} + {int(height) * int(height)} \n")53 print(f"â¡ï¸ sqrt Hypotenius = sqrt {hypot} \n")54 print("ð Your Hypotenius Is = ", end = "")55 print(sqrt(hypot))56 57 elif hypot < base or hypot < height :58 print("\n Don't Make Me A Fool ! - Because Hypotenius Is Bigger Than Both ð") 596061 elif base == 0 :62 base = int(hypot) * int(hypot) - int(height) * int(height)63 print("")64 print(f"â¡ï¸ Base = {int(hypot)} Â² - {int(height)} Â²\n")65 print(f"â¡ï¸ Base = {int(hypot) * int(hypot)} - {int(height) * int(height)} \n")66 print(f"â¡ï¸ sqrt Base = sqrt {base} \n")67 print("\nð Your Base Is = " , end = "")68 print(sqrt(base)) 6970 elif height == 0 :71 height = int(hypot) * int(hypot) - int(base) * int(base)72 print("")73 print(f"â¡ï¸ Height = {int(hypot)} Â² - {int(base)} Â²\n")74 print(f"â¡ï¸ Height = {int(hypot) * int(hypot)} - {int(base) * int(base)} \n")75 print(f"â¡ï¸ sqrt Height = sqrt {height} \n")76 print("\nð Your Height Is = ", end = "" )77 print(sqrt(height))7879 else :80 print("\n ð Good Byy Sir ðð\n")81 print("\n ð° Thanks For Using Our Code ! ð°\n")82 83 84 inputs_work()85 print("\n------------------------------------------------------------------------------------------------------------------------------------------------------------------\n") 86 87window = Pythagoras()88 ...```

plugin.py

Source:plugin.py

`...28 if contour.nodes[n+1].type == "offcurve" and contour.nodes[n].type == "line":29 #calcular hipotenusa e angulo da recta30 AR = (contour.nodes[n].x - contour.nodes[n-1].x)31 BR = (contour.nodes[n].y - contour.nodes[n-1].y)32 HypotRecta = math.hypot(BR, AR)33 AngleRecta = 034 if AR >= 0 and BR > 0:35 AngleRecta = math.degrees(math.asin(BR / HypotRecta))36 if AR < 0 :37 AngleRecta = math.degrees(math.asin(BR / HypotRecta))*-1+18038 if AR >= 0 and BR < 0:39 AngleRecta = math.degrees(math.asin(BR / HypotRecta))+36040 #calcular hipotenusa e angulo do Handle41 AH = (contour.nodes[n+1].x - contour.nodes[n].x)42 BH = (contour.nodes[n+1].y - contour.nodes[n].y)43 HypotHandle = math.hypot(BH, AH)44 AngleHandle = 045 if AH >= 0 and BH > 0:46 AngleHandle = math.degrees(math.asin(BH / HypotHandle))47 if AH < 0 :48 AngleHandle = math.degrees(math.asin(BH / HypotHandle))*-1+18049 if AH >= 0 and BH < 0:50 AngleHandle = math.degrees(math.asin(BH / HypotHandle))+36051 #CorrigirPonto52 if abs(HypotRecta) > abs(HypotHandle)*0.75:53 if AngleRecta - AngleHandle > 355 and AngleRecta - AngleHandle < 360 or abs(AngleRecta - AngleHandle) < 5 or contour.nodes[n].connection == 100 :54 contour.nodes[n+1].x = contour.nodes[n].x + math.cos(math.radians(AngleRecta))*HypotHandle55 contour.nodes[n+1].y = contour.nodes[n].y + math.sin(math.radians(AngleRecta))*HypotHandle56 #Curve to Line57 if contour.nodes[n-1].type == "offcurve" and contour.nodes[n].type == "curve" and contour.nodes[n+1].type == "line":58 #calcular hipotenusa e angulo da recta59 AR = (contour.nodes[n].x - contour.nodes[n+1].x)60 BR = (contour.nodes[n].y - contour.nodes[n+1].y)61 HypotRecta = math.hypot(BR, AR)62 AngleRecta = 063 if AR >= 0 and BR > 0:64 AngleRecta = math.degrees(math.asin(BR / HypotRecta))65 if AR < 0 :66 AngleRecta = math.degrees(math.asin(BR / HypotRecta))*-1+18067 if AR >= 0 and BR < 0:68 AngleRecta = math.degrees(math.asin(BR / HypotRecta))+36069 #calcular hipotenusa e angulo do Handle70 AH = (contour.nodes[n-1].x - contour.nodes[n].x)71 BH = (contour.nodes[n-1].y - contour.nodes[n].y)72 HypotHandle = math.hypot(BH, AH)73 AngleHandle = 074 if AH >= 0 and BH > 0:75 AngleHandle = math.degrees(math.asin(BH / HypotHandle))76 if AH < 0 :77 AngleHandle = math.degrees(math.asin(BH / HypotHandle))*-1+18078 if AH >= 0 and BH < 0:79 AngleHandle = math.degrees(math.asin(BH / HypotHandle))+36080 #CorrigirPonto81 if abs(HypotRecta) > abs(HypotHandle)*0.75:82 if AngleRecta - AngleHandle > 355 and AngleRecta - AngleHandle < 360 or abs(AngleRecta - AngleHandle) < 5 or contour.nodes[n].connection == 100 :83 contour.nodes[n-1].x = contour.nodes[n].x + math.cos(math.radians(AngleRecta))*HypotHandle84 contour.nodes[n-1].y = contour.nodes[n].y + math.sin(math.radians(AngleRecta))*HypotHandle85 # print(layer, inEditView, customParameters) # DEBUG86 @objc.python_method...`

face_crop.py

Source:face_crop.py

`...17 img = cv2.resize(img, (cols * max_size / l, rows * max_size / l))18 rows, cols, _ = img.shape19 # create gray image for rotate20 gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)21 hypot = int(math.ceil(math.hypot(rows, cols)))22 frame = np.zeros((hypot, hypot), np.uint8)23 frame[(hypot - rows) * 0.5:(hypot + rows) * 0.5, (hypot - cols) * 0.5:(hypot + cols) * 0.5] = gray24 def translate(coord, deg):25 x, y = coord26 rad = math.radians(deg)27 return {28 'x': ( cos(rad) * x + sin(rad) * y - hypot * 0.5 * cos(rad) - hypot * 0.5 * sin(rad) + hypot * 0.5 - (hypot - cols) * 0.5) / float(cols) * 100.0,29 'y': (- sin(rad) * x + cos(rad) * y + hypot * 0.5 * sin(rad) - hypot * 0.5 * cos(rad) + hypot * 0.5 - (hypot - rows) * 0.5) / float(rows) * 100.0,30 }31 # filename numbering32 numb = 033 for deg in range(-48, 49, 6):34 M = cv2.getRotationMatrix2D((hypot * 0.5, hypot * 0.5), deg, 1.0)35 rotated = cv2.warpAffine(frame, M, (hypot, hypot))...`

## Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.