Write a function called area_circumference_generator that takes a radius of a circle as a
function parameter and calculates its circumference and area. Then returns these two results as
a tuple and prints the results using tuple unpacking in the function call according to the given
format.
[Must use tuple packing & unpacking]
===================================================================
Example1:
Function Call:
area_circumference_generator(1)
Output:
(3.141592653589793, 6.283185307179586)
Area of the circle is 3.141592653589793 and circumference is 6.283185307179586
from math import pi
def area_circumference_generator(r):
area = pi * r * r
circ = 2 * pi * r
return (area, circ)
result = area_circumference_generator(1)
print(result)
area, circ = area_circumference_generator(1)
print("Area of the circle is", area, "and circumference is", circ)
Comments
Leave a comment