Can some explain why this wont draw a circle? It is drawing roughly 3/4?

Posted by Brandon Shockley on Stack Overflow See other posts from Stack Overflow or by Brandon Shockley
Published on 2013-10-28T09:50:08Z Indexed on 2013/10/28 9:53 UTC
Read the original article Hit count: 262

Filed under:

If we want to use n small lines to outline our circle then we can just divide both the circumference and 360 degrees by n (i.e , (2*pi*r)/n and 360/n).

Did I not do that?

import turtle, math

window = turtle.Screen()
window.bgcolor('blue')

body = turtle.Turtle()
body.pencolor('black')
body.fillcolor('white')
body.speed(10)
body.width(3)
body.hideturtle()
body.up()
body.goto(0, 200)

lines = 40

toprad = 40

top_circum = 2 * math.pi * toprad

sol = top_circum / lines
circle = 360 / lines

for stops in range(lines):
    body.pendown()
    body.left(sol)
    body.forward(circle)


window.exitonclick()

© Stack Overflow or respective owner

Related posts about python