Using JES/Jython
Function Name: approachAllAngles()
Parameters: Sides- integer of how many sides the shape has
Using the formula, D = ((Number of sides - 2) * 180) / Number of
sides write a function that takes in the number of sides in your polygon and prints a
sentence containing the angle measurements and the number of sides in the polygon.
Test Cases:
>>>approachAllAngles(4)
Each angle in a regular polygon with 4 sides measures 90 degrees.
>>>approachAllAngles(9)
Each angle in a regular polygon with 9 sides measures 140 degrees.
def approachAllAngles(sides):
# Calculate angle and print result
D = ((sides-2)*180)/sides
print "Each angle in a regular polygon with",sides,"sides
measures",D,"degrees."
return
approachAllAngles(4)
approachAllAngles(9)
SCREENSHOT-
OUTPUT -
Get Answers For Free
Most questions answered within 1 hours.