Mary has written a correct program based on her learning from Exercise 3 of Lab 04....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Mary has written a correct program based on her learning from Exercise 3 of Lab 04. Peter has also written a program: # Mary's program (Correct) 1 import math 2 3 a, b, c = ( 4 float(input("a:")), 5 float(input("b:")), 6 float(input("c:")), 7) 8 9 dbb-4 10 11 if a == 0: if b == 0: 12 13 14 15 16 17 18 result = "One root for Linear Eq" 19 elif math.isclose(d, 0, abs_tol-1e-9): 20 result "One repeated root" 21 else: 22 result = "Two roots" if c == 0: result = "Infinite roots" else: else: result = "No solution" # Peter's program 1 import math 7868WNH 2 3 a, b, c = ( 9 d = b 10 float (input ("a:")), float (input("b:")), float (input ("c:")), == 11 if (a == 0) and (b == 0) and (c) result = "Infinite roots" 12 13 if (a == 0) and (b== 0) and (c != 0): 14 result = "No solution" 15 if (a == - 0) and (b != 0): 16 89822 b-4 a c 20 17 if (a != 0) and math.isclose(d, 0, abs_tol-1e-9): 18 result = "One repeated root" 19 else: 21 result = "One root for Linear Eq" 0): result "Two roots" Please choose the correct options for the statements below: (1) For the equation x² + 2x = 0, Mary's program will step through lines 1, 3-7, 9, [Select] , and then finish. (2) For the equation x² + 2x = 0, Peter's program will step through lines 1, 3-7,9, [Select] , and then finish. (3) For the equation 2x + 3 = 0, Mary's program will set result to [Select] (4) For the equation 2x + 3 = 0, Peter's program will set result to [Select] (1) Options: a11,12,13,19,22 b. 11,19, 22 (2) Options: a. 11,13,15,17,20 b. 17,20 (3) Options: a. infinite roots b. No solution c. One repeated root d. One root for Linear Eq e. Two roots (4) Options: a. Two roots b. One repeated roots Mary has written a correct program based on her learning from Exercise 3 of Lab 04. Peter has also written a program: # Mary's program (Correct) 1 import math 2 3 a, b, c = ( 4 float(input("a:")), 5 float(input("b:")), 6 float(input("c:")), 7) 8 9 dbb-4 10 11 if a == 0: if b == 0: 12 13 14 15 16 17 18 result = "One root for Linear Eq" 19 elif math.isclose(d, 0, abs_tol-1e-9): 20 result "One repeated root" 21 else: 22 result = "Two roots" if c == 0: result = "Infinite roots" else: else: result = "No solution" # Peter's program 1 import math 7868WNH 2 3 a, b, c = ( 9 d = b 10 float (input ("a:")), float (input("b:")), float (input ("c:")), == 11 if (a == 0) and (b == 0) and (c) result = "Infinite roots" 12 13 if (a == 0) and (b== 0) and (c != 0): 14 result = "No solution" 15 if (a == - 0) and (b != 0): 16 89822 b-4 a c 20 17 if (a != 0) and math.isclose(d, 0, abs_tol-1e-9): 18 result = "One repeated root" 19 else: 21 result = "One root for Linear Eq" 0): result "Two roots" Please choose the correct options for the statements below: (1) For the equation x² + 2x = 0, Mary's program will step through lines 1, 3-7, 9, [Select] , and then finish. (2) For the equation x² + 2x = 0, Peter's program will step through lines 1, 3-7,9, [Select] , and then finish. (3) For the equation 2x + 3 = 0, Mary's program will set result to [Select] (4) For the equation 2x + 3 = 0, Peter's program will set result to [Select] (1) Options: a11,12,13,19,22 b. 11,19, 22 (2) Options: a. 11,13,15,17,20 b. 17,20 (3) Options: a. infinite roots b. No solution c. One repeated root d. One root for Linear Eq e. Two roots (4) Options: a. Two roots b. One repeated roots
Expert Answer:
Answer rating: 100% (QA)
The solution is following 1 For the equation x2 2x 0 Marys program will step through lines 1 37 9 a ... View the full answer
Related Book For
College Algebra With Modeling And Visualization
ISBN: 9780134418049
6th Edition
Authors: Gary Rockswold
Posted Date:
Students also viewed these programming questions
-
A company hosts a webinar with 200 registered attendees. On the day of the webinar, 150 attendees actually participate. Calculate the webinar's attendance rate as a percentage.
-
A researcher wanted to find out if there was difference between older movie goers and younger movie goers with respect to their estimates of a successful actors income. The researcher first...
-
If the focal length of a lens is 3 centimeters and the image distance is 5 centimeters from the lens, what is the distance from the object to the lens?
-
Unlike affirmative action, diversity _ _ _ _ _ . a . can exist even if organizations do not take purposeful steps to create it b . is required by law for private employers with 5 0 or more employees...
-
A thin circular rod is supported in a vertical plane by a bracket at A. Attached to the bracket and loosely wound around the rod is a spring of constant k = 40 N/m and undeformed length equal to the...
-
Determine the total heat transfer for the reversible process 1-3 shown in Fig. P758. 3 360 55 1 2 S, kJ/K T, C
-
A loan of $\$ 50,000$ is due 10 years from today. The borrower wants to make annual payments at the end of each year into a sinking fund that will earn interest at an annual rate of 10 percent. What...
-
1. A patent increases the incentive to develop new products because it ________ the price of the product and thus generates profit to cover a firms costs of _______. 2. In some cases, a patent is...
-
what will this code print out? 123456ROGDENE 7 8 9 10 11 1 public class TraceIf { public static void main(String[] args) { int var1 = 52; var1 %= 5; if (var1 == 0) { System.out.println("Hello"); }...
-
Managers often assume a strictly linear relationship between cost and the level of activity. Under what conditions would this be a valid or invalid assumption?
-
A needle 5 cm long can just rest on the surface of the water without wetting. What is its weight? Surface tension of water = 0.07 N/m.
-
Explain the relationship between the present value and time if discount rate is kept constant.
-
27. Consider a bond with 10 year to maturity, 10% coupon rate, and 15% yield to maturity. Suppose its modified duration is 8.5 years, and convexity is 56. a. What is its Macaulay duration? b. What...
-
How can you use zero-coupon yields to calculate implied one-year forward rates? Give an example.
-
The stock has an Alpha of 2% and a Beta of 1.2. The market return is 8% and the risk free rate is 1%. The Expected return is 11%. what is the firm specific return (residual) next year?
-
Is it appropriate for nonprofit organizations who rely upon donations to invest in risky assets such as the stock market?
-
Arbour Inc. had the following balances on its balance sheet at the beginning of year 4. The balances in the two accounts are "normal" (so Accounts receivable is a positive asset and the allowance is...
-
Coastal Refining Company operates a refinery with a distillation capacity of 12,000 barrels per day. As a new member of Coastal's management team, you have been given the task of developing a...
-
Use the binomial theorem to expand each expression. (m + 2)
-
The graph of y = f(x) is shown in the figure. Sketch a graph of each equation using translations of graphs and reflections. Do not use a graphing calculator f(x) = 2x (a) y = 2 - 2 (b) y = 2-1 (c) y...
-
Graph y = f(x) in the viewing rectangle [-4.7,4.7, 1] by [-3.1, 3.1, 1]. (a) Use the graph to evaluate f(2). (b) Evaluate f(2) symbolically. (c) Let x = -3, -2, -1, 0, 1, 2, 3 and make a table of...
-
Suppose a species of bacteria divides once every 20 minutes. You start with a single bacterium on your unrefrigerated egg-and-baloney sandwich at 8:00 am. Show that when you sit down to lunch at...
-
The lightest and heaviest flying birds are the bee hummingbird of Cuba, which weighs about 1.6 grams, and the great bustard of Europe and Asia, which can weigh as much as 21 kilograms. Show that the...
-
What is a chemoautotroph? What does a chemoautotroph have in common with a plant? How does a chemoautotroph differ from a plant in how it obtains food?
Study smarter with the SolutionInn App