Write a Python program that calculates the area and the circumferenceof a circle whose radius is described by the equation:r=√(x−h)2+(y−k)2+(z−m)2-------------------(1)Your code must have a main( ) and a getValues(center, point) functions.1.The main function reads data from an input file, which has theformat shown below. Each line in the file starts with a serialnumber followed by h, k, m, x, y, and then z (see Fig. 1). 2.For each sphere, the function getValues(center, point) receivestwo lists center (containing h,k, and m) and point (containing x,y, and z). Then it returns a list containing the radius, surfacearea and volume of the sphere use Equation 2 and 3 below. area=4πr2----------------------------(2)volume=43πr3----------------(3)3.This list is received by the main function and it is written it in an output file.4.In addition to that, your main function will count how many spheres have a surface areas less than 200 units2.Note: You program must be general and works for any number of experiments. All reading and writing must be done in the main function. Sample input file below: (you can copy/paste and save below data as text file for input)1 9.07 4.09 4.84 5 7.19 3.42 2 5.585.519.341.028.611.4236.773.771.58.173.244.742.192.837.095.855.737.9555.860.189.163.912.69.11 Sample output file below:SnrAreaVolume15.31354.32627.1529.651170.213764.1833.53156.59184.2544.75283.53448.9253.11121.54126Number of circles with surface area less than 200 units sq = 3
Write a Python program that calculates the area and the circumferenceof a circle whose radius is described by the equation:r=√(x−h)2+(y−k)2+(z−m)2-------------------(1)Your code must have a main( ) and a getValues(center, point) functions.1.The main function reads data from an input file, which has theformat shown below. Each line in the file starts with a serialnumber followed by h, k, m, x, y, and then z (see Fig. 1). 2.For each sphere, the function getValues(center, point) receivestwo lists center (containing h,k, and m) and point (containing x,y, and z). Then it returns a list containing the radius, surfacearea and volume of the sphere use Equation 2 and 3 below. area=4πr2----------------------------(2)volume=43πr3----------------(3)3.This list is received by the main function and it is written it in an output file.4.In addition to that, your main function will count how many spheres have a surface areas less than 200 units2.Note: You program must be general and works for any number of experiments. All reading and writing must be done in the main function.
Sample input file below: (you can copy/paste and save below data as text file for input)1 9.07 4.09 4.84 5 7.19 3.42 2 5.585.519.341.028.611.4236.773.771.58.173.244.742.192.837.095.855.737.9555.860.189.163.912.69.11
Sample output file below:SnrAreaVolume15.31354.32627.1529.651170.213764.1833.53156.59184.2544.75283.53448.9253.11121.54126Number of circles with surface area less than 200 units sq = 3
Step by step
Solved in 2 steps with 2 images