anonymous
  • anonymous
Hi, could someone take a look and see what the problem is, please. The problem is with the equation in f_sizeAngle(). I am trying to get an app to draw a geometric shape defined by the number I enter for sides. For example, I enter 3 to draw a triangle. f_sizeAngle() assumes a regular polygon. According to that equation, for a triangle, it should send 60 for angle size to f_draw(). However, the angles that get drawn are closer to 100 degrees. I will post it next post:
MIT 6.001 Structure and Interpretation of Computer Programs, Spring 2005
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get our expert's

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this
and thousands of other questions.

anonymous
  • anonymous
Hi, could someone take a look and see what the problem is, please. The problem is with the equation in f_sizeAngle(). I am trying to get an app to draw a geometric shape defined by the number I enter for sides. For example, I enter 3 to draw a triangle. f_sizeAngle() assumes a regular polygon. According to that equation, for a triangle, it should send 60 for angle size to f_draw(). However, the angles that get drawn are closer to 100 degrees. I will post it next post:
MIT 6.001 Structure and Interpretation of Computer Programs, Spring 2005
katieb
  • katieb
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get this expert

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this
and thousands of other questions

anonymous
  • anonymous
## create a program where the user can request a turtle to draw the object of choice. ## the object will be selected by entering the number of sides the object contains. ## the program will use the sides to calculate the size of the angle and will forward this ## information to a function that will draw the object from swampy.TurtleWorld import * world = TurtleWorld() bob = Turtle() t = Turtle() sides = int() print bob def f_enterSides(sides): ## careful since raw_input is a string value it must be converted to integer before being ## passed on to f_sizeAngle() or there will be a type error x = raw_input("Please enter the number of sides of the object: " ) int_x = int(x) f_sizeAngle(int_x) ## compute size of angle from number of sides def f_sizeAngle(sides): n = int(sides) sizeAngle = (n - 2) * 180 / n ## with sides/n = 3, sizeAngle should = 60. however, it doesn't f_draw(sizeAngle, n, t) ## draw object def f_draw(sizeAngle, sides, t): for i in range (sides): fd(t, 100) lt(t, sizeAngle) print t ## f_sizeAngle(3) f_enterSides(sides) ##wait_for_user()
anonymous
  • anonymous
my guess would be that the swampy module must define angle as external, and my equation is internal....
anonymous
  • anonymous
... when I enter 4 for sides (iow, a square) it works. the angles are drawn corrently. but anything smaller or larger than 90 degrees is off.

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

anonymous
  • anonymous
changing sizeAngle = 360 / n is the answer. so i guess i was using interior and the module was using exterior.... thanks y'all, for lettin me think out loud

Looking for something else?

Not the answer you are looking for? Search for more explanations.