Question
Python 3.6 - Create an algorithm in a stand alone file. The program should calculate the length of the hypotenuse of a right triangle, given
Python 3.6 -
Create an algorithm in a stand alone file. The program should calculate the length of the hypotenuse of a right triangle, given the length of other two sides. Your program must read the lengths of the other two sides from a data file. Create a data file which has two values on each line, representing the two sides of a right triangle. Your data file should include at least five triangles; be sure at least some of the input data give resultsthat you can confirm are showing the correct answer. The program must determine from reading the file how many triangles re represented by the data in the file. Your program must open this data file, read the values in and calculate thelength of the hypotenuses for any many triangles as are represented in the file. The length of all three sides, the two input and the calculated hypotenuse, should be displayed onthe screen, and they should also be written to a file on the disk. Try to modularize your program by including functions to handle as many of the smaller steps as possible along the way.
Example of output:
Python 3.6.2 Shell File Edit Shell Debug Options Window Help For triangle number 1 the three sides are: Side 1: 3.00 Side 2: 4.00 Side 3: 5.0000 where Side 3 is the hypotenuse of the right triangle. For triangle number 2 the three sides are: Side 1: 4.00 Side 2: 5.00 Side 3: 6.4031 where Side 3 is the hypotenuse of the right triangle. For triangle number 3 the three sides are: Side 1: 6.00 Side 2: 10.00Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started