This link (https://www.mathsisfun.com/geometry/interior-angles-polygons.html) says that the formula for interior angle is (n-2)*180/n. When I tried to use it in my Python program then the pentagon didn't draw correctly (in fact what was drawn wasn't even a polygon). I had to change the formula to 360/n. Did Is the link incorrect.
import turtle
def polygon(sides, length):
bob = turtle.Turtle()
#print(bob)
#angle = ((sides-2)*180)/sides --> doesn't work
angle = 360/sides #works
#print("angle is "+angle)
for i in range(sides):
bob.fd(100)
bob.lt(angle)
polygon(5,100)
turtle.mainloop()
The interior angle of a poligon is $\frac{(n-2)\cdot180}{n}$. The exterior angle is $\frac{360}{n}$. You probably mixed them up. You can check that this formula works for a few poligons or search a proof in the internet.
You have to write $\frac{360}{n}$ because the turtle module of Python uses exterior angles, not interior ones.