Created
April 11, 2022 11:30
-
-
Save les-peters/1a2156b8298445810ad2a4c2a0ef9625 to your computer and use it in GitHub Desktop.
Interior Angle Size
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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