1.

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»

def area_circle (): 

import math 

diameter=float (raw_input (“Enter the diameter in Inches)) 

radius = diameter 12 

area_circle_inches = (math.pi) * (radius * * 2) 

print “The area of circle, area_circle_ inches 

return (area_circle_inches)



Discussion

No Comment Found