Tuples as return values 1

Tuples as return values

def f(r):
    """ Return (circumference, area) of a circle of radius r """
    c = 2 * math.pi * r
    a = math.pi * r * r
    return (c, a)

Here is what the above code is Doing:
1. The function f is defined.
2. The function f takes one argument, r.
3. The function f returns a tuple of two values.
4. The function f computes the circumference and area of a circle of radius r.

Similar Posts