Create your own function that calculate the maximum and minimum of two numbers. Then compare the...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Create your own function that calculate the maximum and minimum of two numbers. Then compare the results with Python's built-in functions max() and min(). 1. Define a function called own_max () which calculates the maximum of the integers a and b. It is possible to calculate without if with this formula: (la - b| means the absolute value of a - b) The function should return an integer. 2. Define a function called own_min ( ) which calculates the maximum of the integers a and b according to the formula: The function should return an integer. 3. Ask the user for two numbers and then print out the result of own_max ( ), max ( ), own min (), min () on the numbers. Leave a blank line after the input and between the maximum and minimum result. Number 1: 39 Number 2: 14 CODE SHOULD PRINT OUT LIKE THIS: own_max (39, 14) = 39 max (39, 14) 39 a + b +la-bl 2 = own min (39, 14) = 14 min (39, 14) 14 a+b-la-bl 2 = Create your own function that calculate the maximum and minimum of two numbers. Then compare the results with Python's built-in functions max() and min(). 1. Define a function called own_max () which calculates the maximum of the integers a and b. It is possible to calculate without if with this formula: (la - b| means the absolute value of a - b) The function should return an integer. 2. Define a function called own_min ( ) which calculates the maximum of the integers a and b according to the formula: The function should return an integer. 3. Ask the user for two numbers and then print out the result of own_max ( ), max ( ), own min (), min () on the numbers. Leave a blank line after the input and between the maximum and minimum result. Number 1: 39 Number 2: 14 CODE SHOULD PRINT OUT LIKE THIS: own_max (39, 14) = 39 max (39, 14) 39 a + b +la-bl 2 = own min (39, 14) = 14 min (39, 14) 14 a+b-la-bl 2 =
Expert Answer:
Answer rating: 100% (QA)
Sure here is the code for the three functions Python ... View the full answer
Related Book For
Microeconomics An Intuitive Approach with Calculus
ISBN: 978-0538453257
1st edition
Authors: Thomas Nechyba
Posted Date:
Students also viewed these programming questions
-
A radioactive isotope of cobalt emits a photon of wavelength 9.30 x 10 -12 m. The cobalt nucleus contains 27 protons and 33 neutrons. The cobalt nucleus is in a crystal containing 6.02 x 10 17...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Formularium Management III Kevin Denis June 18, 2014 Use at own risk. Part I Inventory Control 1 Known demand (p198) 1.1 Basic EOQ model (p210) Assumptions: 1. Demand is xed at units per unit time....
-
Identify in which ledger (general or subsidiary) each of the following accounts is shown: 1. Rent Expense 2. Accounts Receivable-Chen 3. Bank Loan Payable 4. Service Revenue 5. Salaries Payable 6....
-
What is the magnification of a lens used with a relaxed eye if its focal length is 16 cm?
-
Working within the vector space C4, determine if is in the subspace W, 1101 2112 1 1031 12-11
-
What ethical problems should you be aware of in searching social medial sites?
-
Alitech Corporation is liquidating under Chapter 7 of the Bankruptcy Act. The accounts of Alitech at the time of filing are summarized as follows: The land and building are pledged as security for...
-
1. What is SWOT? please send the references 2. What is the the SWOT analysis for G & E Automotive Diagnostics Solutions in the form of table 3. Recommendation of SWOT on the G & E Automotive...
-
Consider the data in Figure 5.25 for Deb?s Dance Studio: Adjustment Data 1. Insurance expired, $1,000. 2. Dance supplies on hand, $1,100. 3. Depreciation on dance equipment, $2,500. 4. Salaries...
-
Engage in ethnographic writing. Describe the musical event with "thick and rich descriptions". about 1 page minimum Assignment Ethnographic writing of Irish music
-
What is the magnitude of vector labeled with " M " ? Provide your answer in cm , with 2 significant digits ( not in scientific notation ) . What is the magnitude of vector labeled with " N " ?...
-
What is the output of the following code: Hinclude int main () \{ int Tab [5] = $\{1,2,3,4,1\} ;$ int *ptr = Tab; printf("\\%d,%d,%d ", Tab[0],*(ptr+2), ptr[2]); return 0; \}
-
Compute the realized and recognized gain or loss for each of the following transactions and classify as short-term or long-term: a. Marge, a single taxpayer, receives $8,000 for the sale of stock she...
-
You have just been hired by FAB Corporation, the manufacturer of a revolutionary new garage door opening device. The presid asked you to review the company's costing system and "do what you can to...
-
Stefan is single and is living in Toronto. He is 66 years old and has worked with the same employer for over 35 years. Stefan is the store manager at a very successful bookstore, Magenta Inc....
-
A company that you target to invest in has just announced that it has successfully obtained a seven-year bank loan for its business' future expansion. The news urges you to re-evaluate the company's...
-
Stephen Schor, an accountant in New York City, advised his client, Andre Romanelli, Inc., to open an account at J. P. Morgan Chase Bank, N.A., to obtain a favorable interest rate on a line of credit....
-
A: Suppose that all firms in the fast food restaurant business face U-shaped average cost curves prior to the introduction of a recurring license fee. The only output they produce is hamburgers....
-
One topic investigated by behavioral economists but not covered in the text relates to how individuals assess probabilities of random events occurring repeatedly. The hot-hand fallacy is the fallacy...
-
Suppose you own a business that does well during economic expansions but not so well during recessions which happen with probability . Let xE denote your consumption level during expansions and let...
-
Restore the file Wild Water Sports Ch 06A (Backup) you downloaded from the student companion site and then save it as Wild Water Sports Ch 06A. If you are asked to setup an external accountant user,...
-
You must have completed Exercise 1 in this chapter to complete this exercise. Restore the backup file you created in Exercise 1. Change the company name to Boston Catering Ch 6 Ex 2. Add the...
-
You must have completed Exercise 1 in this chapter to complete this exercise. Restore the backup file you created in Exercise 1. Change the company name to Boston Catering Ch 6 Ex 3. Add the...
Study smarter with the SolutionInn App