Answer to Question #329089 in Python for ratul

Question #329089

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


1
Expert's answer
2022-04-19T03:08:19-0400
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)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS