Question: when I run this program, it states 'diameter' is not defined. I have followed the instructions given but the program will not run sis admg

 when I run this program, it states 'diameter' is not defined.
I have followed the instructions given but the program will not runwhen I run this program, it states 'diameter' is not defined. I have followed the instructions given but the program will not run

sis admg Normal Strong Subtitle Paragraph Styles 2 3 4 5 1. Write a function that will compute the area of a circle given its diameter. a. Write the following function header (below) above the main function. In this function you will pass in a circle diameter and the function will compute and retum the area of a circle: def compute area circle(diameter): b. For the function body compute the area of the circle which is PI * radius i. In Python, you can use math pi to get the value of PI. 1. Since you are using math.pi you will need to add an import math statement to the top of the file. c. Remember you will need to divide the diameter in half to get the radius of the circle. d. Make sure to return the area that was computed. e. The code for the compute area, circle function should look like the following: def compute area circle(diameter): radius = diameter / 2.0 area = math.pi* radius ** 2 return area f. Within the main function add a function call to compute area circle passing in a diameter and then after the function call add a print statement to print out the diameter and area of the circle that was computed. Example output: Area of circle with diameter 8 is: 50.26548245743669 File File Edit Format Run Options Window Help import math def main(): Tal print("Lab 4 by Taylor Brewton") > def compute area circle (diameter): radius diameter / 2.0 ia area math.pi * radius ** 2 Sn return area main() compute_area_circle (diameter) print("Area of circle with diameter", diameter, "is:", area) Tyl

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!