You are going to write a function called
this will take a single value that represents the number of sides of the regular polygon and will return the total of all of the internal angles (the angle sum) and the size of a single internal angle.
If you know how many sides a regular polygon (n) has then you can use this number to calculate the angle sum like this:
Angle sum = (n - 2) x 180
If n is the number of sides then to work out the size of a single angle we just need to divide the Angle Sum by the number of sides. You can either redo the calculation for the Angle sum or just use the value calculated previously:
Interior Angle = (Angle Sum)/n
Interior Angle = ((n - 2) x 180)/n
**Then it wants**
Test the function works correctly and output the results.
Output the results for a regular hexagon (6 sides) and a regular decagon (10 sides). The outputs should match the formatting below exactly.
A regular hexagon has 6 sides, an Angle Sum of xx degrees and an Interior Angle Size of yy degrees
Where xx and yy are the values that
returns when given an argument of 6.
And then do the same for the decagon:
A regular decagon has 10 sides, an Angle Sum of xx degrees and an Interior Angle Size of yy degrees
I have been stuck on this question for a while this what i coded please if you could help comment!
What I have tried:
if(n < 3):
return (n - 2) * 180,(n - 2) * 180/n
# Driver code
print("A regular", end='') # no end of line yet
if sides == 6
if sides == 10
print(" has ", sides, "sides", end='')
print(", an Angle Sum of", anglesum, "degrees", end='')
print(" and an Interior Angle Size of", anglesize, "degrees") # end of line after this
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)