``````from turtle import *
import random

def allTriMedian (w=300):
speed (0)
vertices = []
point = turtle.Point(x,y)

for i in range (3):
x = random.randint(0,300)
y = random.randint(0,300)
vertices.append(trutle.Point(x,y))
point = turtle.Point(x,y)
triangle = turtle.Polygon(vertices)

a = triangle.side()
b = triangle.side()
c = triangle.side()
m1 = tirangle.median
m2 = triangle.median
m3 = triangle.median``````

I tried to put the equation directly

``````def Median (a, b, c):
m1 = sqrt((((2b^2)+(2c^2)-(a^2))))
m2 = sqrt((((2a^2)+(2c^2)-(b^2))))
m3 = sqrt((((2a^2)+(2b^2)-(c^2))))
triangle.setFill("yellow")
triangle.draw(allTriMedian)``````

Or I thought to find a midpoint and draw a line segment to connect the vertices and midpoints.

``````def getMid(p1,p2):
return ( (p1[0]+p2[0]) / 2, (p1[1] + p2[1]))
mid1 = Line((point(p1[0]+p2[0]) / 2),point(x))
mid2 = Line((point(p2[1]+p3[1]) / 2),point(y))``````

Where did you copy and paste this code ? There are many errors: `trutle`, `tirangle`, also what is the `triangle` object, and the method `triangle.setFill` etc ?

Start with a simple code that runs on your python interpreter, so that we can run it too. Start with code that simply draws a triangle, and post the whole running program here.

I/ if you import everything from turtle, like this:
`from turtle import *`

Then you cannot make statements like this:
`point = turtle.Point(x,y)`

You should do: `import turtle`

II/ allTriMedian function is never called. So it is never executed.
You should call it like: `allTriMedian()`

III/ There is no Point and Polygon in turtle. You are calling something, that is not there.

IV/ triangle is a local variable in function allTriMedian. It is not visible outside of it.
The whole program just does not make sense. There are several typos, too.

Thats why you do not get an answer on stackoverflow

V/ Here is something that draws a random triangle:

``````import turtle
import random

window=turtle.Screen()

def gen_triangle_points():
vertices=[]
for i in range (3):
x = random.randint(0,300)
y = random.randint(0,300)
vertices.append((x,y))
return vertices

def draw_shape_from_points(vertices):
pen=turtle.Turtle()
pen.penup()
pen.goto(vertices[0])
pen.pendown()
for point in vertices[1:]:
pen.goto(point)
pen.goto(vertices[0])

vertices=gen_triangle_points()

draw_shape_from_points(vertices)

window.exitonclick()``````
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.