You are not logged in.
Pages: 1
I wrote a python program to plot n number of coordinates or points in graph using Python Turtle:
import turtle
n = abs(int(input("Enter the number or points or vertices: ")))
if n > 25: print("Dont't joke! ")
else:
x = [0]
y = [0]
for i in range(n):
newx = int(input(f'Enter {i + 1} x coordinate: '))
newy = int(input(f'Enter {i + 1} y coordinate: '))
x.append(newx * 4)
y.append(newy * 4)
print()
print(x)
print(y)
t = turtle.Turtle()
t.color('blue')
t.penup()
t.goto(0,0)
t.write('O')
t.pendown()
t.goto(0,250)
t.write('Y')
t.goto(0,-250)
t.penup()
t.forward(10)
t.write("Y'")
t.backward(10)
t.pendown()
t.goto(0,0)
t.goto(250,0)
t.write("X")
t.goto(-250,0)
t.write("X'")
t.goto(0,0)
t.penup()
t.goto(x[1], y[1])
for m in range(2, n+1):
t.pendown()
t.goto(x[m], y[m])
t.goto(x[1], y[1])
Is this useful?
"Talent hits the target no one else can hit. Genius hits the target no one else can see." - Arthur Schopenhauer
Offline
Pages: 1