Ratio of area of two nested polygons formed by connecting midpoints of sides of a regular N | Python3 code for the above approach ; Function to calculate the ratio of area of N - th and ( N + 1 ) - th nested polygons formed by connecting midpoints ; Stores the value of PI ; Calculating area the factor ; Printing the ratio precise upto 6 decimal places ; Driver Code
import math NEW_LINE def AreaFactor ( n ) : NEW_LINE INDENT pi = 3.14159265 NEW_LINE areaf = 1 / ( math . cos ( pi / n ) * math . cos ( pi / n ) ) NEW_LINE print ( ' % .6f ' % areaf ) NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT n = 4 NEW_LINE AreaFactor ( n ) NEW_LINE DEDENT