Got Homework?
Connect with other students for help. It's a free community.
Here's the question you clicked on:
 0 viewing
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:
 one year ago
 one year ago
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:
 one year ago
 one year ago

This Question is Open

ScottLBest ResponseYou've already chosen the best response.0
## 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()
 one year ago

ScottLBest ResponseYou've already chosen the best response.0
my guess would be that the swampy module must define angle as external, and my equation is internal....
 one year ago

ScottLBest ResponseYou've already chosen the best response.0
... 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.
 one year ago

ScottLBest ResponseYou've already chosen the best response.0
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
 one year ago
See more questions >>>
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.