main.py287 chars13 lines
In the above code, we first import math module to use the value of pi. We then define a function sector_area
that takes radius and angle (in degrees) as input and calculates the area of the sector. The formula used to calculate the area of a sector is: (angle/360) * pi * r^2.
We then call the function by passing radius and angle values and store the returned area value in a variable called area
. Lastly, we print the value of area to the console.
gistlibby LogSnag