Skip to content

Instantly share code, notes, and snippets.

@les-peters
Created April 11, 2022 11:30
Show Gist options
  • Save les-peters/1a2156b8298445810ad2a4c2a0ef9625 to your computer and use it in GitHub Desktop.
Save les-peters/1a2156b8298445810ad2a4c2a0ef9625 to your computer and use it in GitHub Desktop.
Interior Angle Size
question = """
Given an integer n representing the number of sides of a regular polygon,
return the measure of each interior angle. Bonus points: implement some of
the other functions listed in the linked Wikipedia page!
Example:
$ interiorAngleSize(3)
$ 60 // Each angle in a triangle that is a regular polygon is 60 degrees
$ interiorAngleSize(8)
$ 135
"""
def interiorAngleSize(n):
return int(180 * (n - 2) / n) if n >= 3 else "error: n cannot be under 3"
print(interiorAngleSize(3))
print(interiorAngleSize(8))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment