import turtle import math laki = turtle.Turtle() laki.hideturtle() laki.color('blue') laki.pensize(3) laki.penup() x1, y1 = 200, 50 x2, y2 = 50, 150 x3, y3 = -100, -100 laki.setpos(x1, y1) laki.pendown() laki.setpos(x2, y2) laki.setpos(x3, y3) laki.setpos(x1, y1) a = math.sqrt((x1-x2)**2 + (y1-y2)**2) b = math.sqrt((x1-x3)**2 + (y1-y3)**2) c = math.sqrt((x3-x2)**2 + (y3-y2)**2) P = a + b + c p = P / 2.0 A = math.sqrt(p * (p-a) * (p-b) * (p-c)) print("Primeter = " + str(P)) print("Area = " + str(A))
اجرا کن
پاک کن