Introduction to Programming using Python 1st Edition

Published by Pearson
ISBN 10: 0132747189
ISBN 13: 978-0-13274-718-9

Chapter 6 - Functions - Programming Exercises - Page 207: 6.17

Answer

code

Work Step by Step

# *6.17 (The MyTriangle module) Create a module named MyTriangle that contains # the following two functions: # # Returns true if the sum of any two sides is # # greater than the third side. # def isValid(side1, side2, side3): # # Returns the area of the triangle. # def area(side1, side2, side3): # Write a test program that reads three sides for a triangle and computes the area if the # input is valid. Otherwise, it displays that the input is invalid. The formula for computing # the area of a triangle is given in Exercise 2.14. from CH6Module import MyFunctions s1, s2, s3 = eval(input("Enter three sides in double: ")) if MyFunctions.isValid(s1, s2, s3): print("The area of the triangle is", MyFunctions.area(s1, s2, s3)) else: print("Input is invalid")
Update this answer!

You can help us out by revising, improving and updating this answer.

Update this answer

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.