Write a function that:
(i) Asks the user to input a diameter of circle in inches.
(ii) Sets a variable called radius to one half of that number.
(iii) Calculate the area of circle.
(iv) Print the area of circle with appropriate unit.
(v) Return this same amount as the output of the function.
Answer:
import math
def
circle_area
():
d=float(input(
"Enter the diameter of the circle in inches: "
))
r=d/
2
area=(math.pi)*(r**
2
)
print(
"Area of a circle with diameter "
,d,
" inches is "
,area,
" sq inches"
)
return (area)