Write a function named hypotenuse(num1, num2) that returns the length of the hypotenuse of a right...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a function named hypotenuse(num1, num2) that returns the length of the hypotenuse of a right angle triangle geometric with sides of length num1 and num2 i.e. sqrt{num1**2 + num2**2} If at least one of the arguments num1, num2 is not a numerical value, the function prints "Cannot compute the hypotenuse!" in the console and exits without crashing the rest of the program. If at least one of the arguments num1, num2 are 0 or negative, the function prints "Triangle sides must be greater than 0!" in the console and exits without crashing the rest of the program. You should use Python's exception handling in this task. [3 marks] Write a function named hypotenuse(num1, num2) that returns the length of the hypotenuse of a right angle triangle geometric with sides of length num1 and num2 i.e. sqrt{num1**2 + num2**2} If at least one of the arguments num1, num2 is not a numerical value, the function prints "Cannot compute the hypotenuse!" in the console and exits without crashing the rest of the program. If at least one of the arguments num1, num2 are 0 or negative, the function prints "Triangle sides must be greater than 0!" in the console and exits without crashing the rest of the program. You should use Python's exception handling in this task. [3 marks]
Expert Answer:
Related Book For
Java Software Structures Designing And Using Data Structures
ISBN: 9780133250121
4th Edition
Authors: John Lewis, Joe Chase
Posted Date:
Students also viewed these programming questions
-
How does mitochondrial dysfunction contribute to aging and age-related diseases, and what are the proposed mechanisms linking mitochondrial quality, oxidative stress, and cellular senescence ?
-
To design a simple experiment that can be conducted in the international space station (with microgravity). Introduction: International Space Station (ISS) is a modular space station that orbits the...
-
Use the table below to find: (fog)(-10) = (fof) (11) = X -10 f(x) -1 g(x) 4 -1 -7 -4 -7 11 (gof)(-4)= (gog)(7) = 4 7 15 4 7 -4 11 -4 15 7 -1 15 -10 -7 -10 11
-
Design a disc brake with a double caliper. Each side of the disc has two 40-mm-diameter pads. The center of the brake pads is at a radius of 150 mm. The outside diameter of the disk is 360 mm. The...
-
How would you evaluate the company's method of communicating the change in pay level? What improvements to that process can you suggest?
-
What is the DuPont Identity and how can a financial manager use it?
-
Simons Realty issued \(\$ 250,000\) of \(6 \%, 10\)-year bonds payable at par value on May 1,2006, four months after the bond's original issue date of January 1, 2006. Journalize the following...
-
Dry ice (solid CO2) has been used as a mine explosive in the following manner. A hole is drilled into the mine wall, filled with dry ice plus a small charge of gunpowder, and then plugged. The...
-
The cost curves for J&M Enterprises have been estimated to be: = 40 9 + 2 2 and = 40 19 + 4 2 where is measured in thousands. What are the fixed costs of production? What is at? What kind of...
-
Reconsider the Profit & Gambit Co. advertising-mix problem presented in Section 2.7. Recall that a major advertising campaign is being planned that will focus on three key products: a stain remover,...
-
What makes GUCCI WORK? Analyze the competitive advantages that make it profitable and scalable as a business. Consider the 7 R's and what the Gucci is doing today that is unique about sustainability....
-
Are you courageous enough to abandon a practice that has made you successful in the past? Great leaders dare to be different. They build the emotional stamina to withstand opposition.?
-
On March 1, 2017 Green Company purchased a new piece of equipment for 210,000 cash. On March 1 Green recorded the equipment purchase with a Debit to the Equipment account and a Credit to the Cash...
-
Read the following article: Goodbye Performance Reviews? written by Natalie Barker, Head of Transformation at Southern Cross Health Insurance and published in the HRNZ magazine (Vol 26, No. 24) in...
-
DanceByte Limited is a leading software development company located in Sandton, Johannesburg. The company's current reporting period ends on 31 December 2018. The following are some of the...
-
In providing accounting services to small businesses, you encounter the following situations. 1. 2. Waterway Corporation rings up cash sales and sales taxes separately on its cash register. On April...
-
Find the terminal velocity of a rain drop of radius 0.01 mm. The coefficient of viscosity of air is 1.8 10 N-s m and its density is 1-2 kg m. Density of water 1000 kg m. Take g = 10 m s. -2 = -5
-
What key concerns must functional tactics address in marketing? Finance? POM? Personnel?
-
Given the resulting sorted list from Exercise 9.4, show a trace of execution for a binary search, searching for the number 235. Exercise 9.4 Consider the following list: 90 8 7 56 123 235 9 1 653...
-
Design a new maze for the MazeSearch program in this chapter, and rerun the program. Explain the processing in terms of your new maze, giving examples of a path that was tried but failed, a path that...
-
Modify the algorithm from the previous exercise so that it makes use of a rear reference. How does this affect the time complexity of this and the other operations?
-
In the Hochfelder case all of the following were factors in the case except a. The Securities Exchange Act of 1934. Data From Exchange Act 1934 When the Securities Act was passed, the Interstate...
-
Refer to the example of an auditors report issued in 1915. List the differences between the report styles in 1915 and today (refer to Chapter 1). Indicate in what ways this report would be deficient...
-
What client actions might cause a CPA to terminate an existing client relationship?
Social Policy For Effective Practice A Strengths Approach 5th Edition - ISBN: 0367357062 - Free Book
Study smarter with the SolutionInn App