Hackerss.com

hackerss
hackerss

Posted on

Python Calculate area of a circle


def area_circle(radius):
    """
    Calculate the area of a circle.

    Parameters
    ----------
    radius : float
        The radius of the circle.

    Returns
    -------
    float
        The area of the circle.
    """

    #return the area of the circle
    return 3.14 * radius ** 2

#example
result = area_circle(5)
#output
print(result)  #78.5


Enter fullscreen mode Exit fullscreen mode

Oldest comments (0)