Jul-23-2019, 12:33 PM
Hello everyone, my name's Tim and I'm a teacher and guess what: I've run out of coding skills
I'm going through the thinkcspy learning program to get a good grip on the foundations of python before I do really funky stuff with networks and robots and stuff.
I'm writing a polygon drawing program with the turtle module. Here's the code:
But I'm not getting the result I should. I'm wondering if there's a syntax error with how I've laid out the arithmetic??
Any help is appreciated

I'm going through the thinkcspy learning program to get a good grip on the foundations of python before I do really funky stuff with networks and robots and stuff.
I'm writing a polygon drawing program with the turtle module. Here's the code:
sides_choice = input("how many sides?") sides = int(sides_choice) print (sides) length_choice = input("how long are the sides?") length = int(length_choice) print (length) lines = input("what colour lines?") print (lines) fill = input("what colour fill?") print (fill) import turtle wn = turtle.Screen() bob = turtle.Turtle() bob.color(lines) bob.fillcolor(fill) for polygon in range(sides): bob.fd(length) bob.left(((sides -2)*180)/sides)My problem is with the last line. I'm pretty confident of the maths being correct because the formula for the total interior angles for a regular polygon is (n-2)*180 where 'n' is the number of sides. And then to get each individual corner angle you then divide the result of the last formula with n again.
But I'm not getting the result I should. I'm wondering if there's a syntax error with how I've laid out the arithmetic??
Any help is appreciated
