0 out of 464 challenges solved
Write a Python function `sector_area` to calculate the area of a sector of a circle. The function should take two parameters: 1. `radius` (float): The radius of the circle. 2. `angle` (float): The angle of the sector in degrees. The function should return the area of the sector. If the angle is greater than 360 degrees, the function should return `None`. #### Example Usage ```python [main.nopy] print(sector_area(4, 45)) # Output: 6.283185307179586 print(sector_area(9, 45)) # Output: 31.808625617596654 print(sector_area(9, 361)) # Output: None ```
import math def sector_area(radius, angle): """ Calculate the area of a sector of a circle. Parameters: radius (float): The radius of the circle. angle (float): The angle of the sector in degrees. Returns: float or None: The area of the sector, or None if the angle is invalid. """ # Check if the angle is valid # Placeholder for the calculation pass