Question: Write a Python program that reads sides of a triangle a , b and c from a file and does the following: a . If

Write a Python program that reads sides of a triangle a, b and c from a file and does the following:
a. If the triangle property i.e. any two sides must be greater than the third side is true then compute
and display the area of a triangle.
Program should have following functions:
Note: column headers are print in the main ()
printResults() : Receives three sides of a triangle and print the result as shown below.
sfun(): sfun receives the values of a, b and c then computes and returns the value of s as
(a+b+c)/2
areafun (): areafun receives the value of s and computes and return the area of a triangle to the main
program using below formulae. A =(s(s-a)(s-b)(s-c))Write a Python program that reads sides of a triangle a, b and c from a file and does the following:
a. If the triangle property i.e. any two sides must be greater than the third side is true then compute
and display the area of a triangle.
Program should have following functions:
Note: column headers are print in the main ()
printResults() : Receives three sides of a triangle and print the result as shown below.
sfun(): sfun receives the values of a, b and c then computes and returns the value of s as
(a+b+c)/2
areafun (): areafun receives the value of s and computes and return the area of a triangle to the main
program using below formulae. A =(s(s-a)(s-b)(s-c))

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 Programming Questions!