Question: .Package Newtons method for approximating square roots (Case Study 3.6) in a function named newton. This function expects the input number as an argument and

.Package Newtons method for approximating square roots (Case Study 3.6) in a function named newton. This function expects the input number as an argument and returns the estimate of its square root. The script should also include a main function that allows the user to compute square roots of inputs until she presses the enter/return key.

import math

class A: def __init__(self): self.number=float(input("Enter No whose square root yoy want to calculate")) self.result=newton(self.number) print("square root of a number is") print(self.result)

def newton(number): numb=number result=math.sqrt(number) return result

a=A()

I have this but I keep getting a "return" outside function error on line 13. Is something not lining up correctly? If I indent that line then it gives me a error of "unexpected indent"

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