16,001,557 members

See more:

I got this as an exam test i need help with it

You are going to write a function called get_angle_sizes() 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 or 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 get_angle_sizes() 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:<pre>def get_angle_sizes(n): if(n < 3): return 0 return (n - 2) * 180,(n - 2) * 180/n # Driver code print(get_angle_sizes(6))

Comments

can you give me the whole code plz

Permalink

Share this answer

Comments

Richard MacCutchan
20-Mar-21 12:27pm

Sorry, no. You have to write it yourself.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject,
20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8
+1 (416) 849-8900

it outputs the Interior angle and the angle sum but I have no idea how to do this:

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

get_angle_sizes()

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