Best Python code snippet using ATX
drill6-1.py
Source:drill6-1.py
...34 turtle.goto(p)35 turtle.color(0.8, 0.9, 0)36 turtle.dot(15)37 turtle.write(' ' + str(p))38def draw_point(p):39 turtle.goto(p)40 turtle.dot(5, random.random(), random.random(), random.random())41def draw_curve_4_points(p1, p2, p3, p4):42 draw_big_point(p1)43 draw_big_point(p2)44 draw_big_point(p3)45 draw_big_point(p4)46 # draw p1-p247 for i in range(0, 50, 2):48 t = i / 10049 x = (2 * t ** 2 - 3 * t + 1) * p1[0] + (-4 * t ** 2 + 4 * t) * p2[0] + (2 * t ** 2 - t) * p3[0]50 y = (2 * t ** 2 - 3 * t + 1) * p1[1] + (-4 * t ** 2 + 4 * t) * p2[1] + (2 * t ** 2 - t) * p3[1]51 draw_point((x, y))52 draw_point(p2)53 # draw p2-p354 for i in range(0, 100, 2):55 t = i / 10056 x = ((-t ** 3 + 2 * t ** 2 - t) * p1[0] + (3 * t ** 3 - 5 * t ** 2 + 2) * p2[0] + (57 -3 * t ** 3 + 4 * t ** 2 + t) * p3[0] + (t ** 3 - t ** 2) * p4[0]) / 258 y = ((-t ** 3 + 2 * t ** 2 - t) * p1[1] + (3 * t ** 3 - 5 * t ** 2 + 2) * p2[1] + (59 -3 * t ** 3 + 4 * t ** 2 + t) * p3[1] + (t ** 3 - t ** 2) * p4[1]) / 260 draw_point((x, y))61 draw_point(p3)62 # draw p3-p463 for i in range(50, 100, 2):64 t = i / 10065 x = (2 * t ** 2 - 3 * t + 1) * p2[0] + (-4 * t ** 2 + 4 * t) * p3[0] + (2 * t ** 2 - t) * p4[0]66 y = (2 * t ** 2 - 3 * t + 1) * p2[1] + (-4 * t ** 2 + 4 * t) * p3[1] + (2 * t ** 2 - t) * p4[1]67 draw_point((x, y))68 draw_point(p4)69 # draw p4-p170 for i in range(0, 100, 4):71 t = i / 10072 x = ((-t ** 3 + 2 * t ** 2 - t) * p3[0] + (3 * t ** 3 - 5 * t ** 2 + 2) * p4[0] + (73 -3 * t ** 3 + 4 * t ** 2 + t) * p1[0] + (t ** 3 - t ** 2) * p2[0]) / 274 y = ((-t ** 3 + 2 * t ** 2 - t) * p3[1] + (3 * t ** 3 - 5 * t ** 2 + 2) * p4[1] + (75 -3 * t ** 3 + 4 * t ** 2 + t) * p1[1] + (t ** 3 - t ** 2) * p2[1]) / 276 draw_point((x, y))77 draw_point((x, y))78 draw_point(p2)79prepare_turtle_canvas()80while True:81 draw_curve_4_points((-300, 200), (400, 350), (300, -300), (-200, -200))...
drill - 6-1.py
Source:drill - 6-1.py
...34 turtle.goto(p)35 turtle.color(0.8, 0.9, 0)36 turtle.dot(15)37 turtle.write(' '+str(p))38def draw_point(p):39 turtle.goto(p)40 turtle.dot(5, random.random(), random.random(), random.random())41def draw_curve_3_points(p1, p2, p3):42 # fill here43 draw_big_point(p1)44 draw_big_point(p2)45 draw_big_point(p3)46 for i in range(0, 100, 2):47 t = i / 10048 x = (2*t**2-3*t+1)*p1[0] + (-4*t**2+4*t)*p2[0] + (2*t**2-t)*p3[0]49 y = (2*t**2-3*t+1)*p1[1] + (-4*t**2+4*t)*p2[1] + (2*t**2-t)*p3[1]50 draw_point((x, y))51 draw_point(p3)52 pass53def draw_curve_4_points(p1, p2, p3, p4):54 draw_big_point(p1)55 draw_big_point(p2)56 draw_big_point(p3)57 draw_big_point(p4)58 # draw p1-p259 for i in range(0, 50, 2):60 t = i / 10061 x = (2*t**2-3*t+1)*p1[0]+(-4*t**2+4*t)*p2[0]+(2*t**2-t)*p3[0]62 y = (2*t**2-3*t+1)*p1[1]+(-4*t**2+4*t)*p2[1]+(2*t**2-t)*p3[1]63 draw_point((x, y))64 draw_point(p2)65 # draw p2-p366 for i in range(0, 100, 2):67 t = i / 10068 x = ((-t**3 + 2*t**2 - t)*p1[0] + (3*t**3 - 5*t**2 + 2)*p2[0] + (-3*t**3 + 4*t**2 + t)*p3[0] + (t**3 - t**2)*p4[0])/269 y = ((-t**3 + 2*t**2 - t)*p1[1] + (3*t**3 - 5*t**2 + 2)*p2[1] + (-3*t**3 + 4*t**2 + t)*p3[1] + (t**3 - t**2)*p4[1])/270 draw_point((x, y))71 draw_point(p3)72 # draw p3-p473 for i in range(50, 100, 2):74 t = i / 10075 x = (2*t**2-3*t+1)*p2[0]+(-4*t**2+4*t)*p3[0]+(2*t**2-t)*p4[0]76 y = (2*t**2-3*t+1)*p2[1]+(-4*t**2+4*t)*p3[1]+(2*t**2-t)*p4[1]77 draw_point((x, y))78 draw_point(p4)79 # draw p4-p180 for i in range(0, 50, 2):81 t = i / 10082 x = (2 * t ** 2 - 3 * t + 1) * p4[0] + (-4 * t ** 2 + 4 * t) * p1[0] + (2 * t ** 2 - t) * p2[0]83 y = (2 * t ** 2 - 3 * t + 1) * p4[1] + (-4 * t ** 2 + 4 * t) * p1[1] + (2 * t ** 2 - t) * p2[1]84 draw_point((x, y))85 draw_point(p2)86prepare_turtle_canvas()87while(True):88 draw_curve_4_points((-300, 200), (400, 350), (300, -300), (-200, -200))...
fidget_spinner.py
Source:fidget_spinner.py
...30 turtle.color(0, 0, 0)31 turtle.speed(50)32 turtle.onkey(stop, 'Escape')33 turtle.listen()34def draw_point(p, r, g, b):35 turtle.goto(p)36 turtle.dot(5, r, g, b)37def fidget_spinner():38 # circle39 for i in range(0, 100, 5):40 t = i * pi / 5041 # center42 x = cos(t) * 6043 y = sin(t) * 6044 draw_point((x, y), 1, 1, 0)45 x = cos(t) * 4046 y = sin(t) * 4047 draw_point((x, y), 1, 1, 0)48 # one49 x = cos(t) * 40 + 18050 y = sin(t) * 4051 draw_point((x, y), 0, 0, 1)52 x = cos(t) * 20 + 18053 y = sin(t) * 2054 draw_point((x, y), 0, 0, 1)55 # two56 x = cos(t) * 40 - 8057 y = sin(t) * 40 + 15058 draw_point((x, y), 0, 0, 1)59 x = cos(t) * 20 - 8060 y = sin(t) * 20 + 15061 draw_point((x, y), 0, 0, 1)62 # three63 x = cos(t) * 40 - 8064 y = sin(t) * 40 - 15065 draw_point((x, y), 0, 0, 1)66 x = cos(t) * 20 - 8067 y = sin(t) * 20 - 15068 draw_point((x, y), 0, 0, 1)69 # body70 for i in range(0, 100, 1):71 t = i * pi / 5072 x = (2 + 0.75*cos(3*t)) * cos(t) * 10073 y = (2 + 0.75*cos(3*t)) * sin(t) * 10074 draw_point((x, y), 1, 0, 0)75prepare_turtle_canvas()76fidget_spinner()...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!