I am trying an exercise which asks me to draw the letters of the alphabets using turtle in Python. So far I think I have a decent understanding of how to draw lines, curves, and shapes using forward/backward distance and turning angles.
I am trying to draw the letter 'B', and here is my design:
Note that all the black lines are equal in distance, and the diameter of the arc is also equal to 1 black line. Here is the incomplete function I have:
def arc(t, r, angle, n):
arc_length = 2*math.pi*r*(angle/360)
def polyline(t, length, n):
for i in range(n):
t.fd(length/n)
t.lt(angle/n)
polyline(t, arc_length, n)
def draw_b(t):
t.fd(30)
arc(t, 30, 180, 10)
t.fd(30)
t.lt(90)
t.fd(30)
t.bk(60)
It should give me 2 exactly parallel lines connected by the bottom arc, but instead I get this:
Ignoring the incomplete top part, how can I fix this problem where the 2 ends of the arc clearly do not coincide, hence leaving a short "tail"? Have I done something wrong?



