Answer:
def newton(n):
#Define the variables.
t = 0.000001
esti = 1.0
#Calculate the square root
#using newton method.
while True:
esti = (esti + n / esti) / 2
dif = abs(n - esti ** 2)
if dif <= t:
break
#Return the result.
return esti
#Define the main function.
def main():
#Continue until user press enters.
while True:
try:
#Prompt the user for input.
n = int(input("Enter a number (Press Enter to stop):"))
#display the results.
print("newton = %0.15f" % newton(n))
except:
return
#Call the main function.
main()
Answer:
Windows OS is software....
Answer:
How was the addition of an improvement over early web design? Webpages could finally incorporate tables into the design
Answer:
Following are the program in the Python Programming Language.
#declare variables and initialize to 0
s=0
n=0
avg=0
#set the infinite while loop
while(True):
#get input from the user
score=input()
#set if statement to break loop
if(score =="stop"):
break
#otherwise, perform calculation
else:
n+= 1
s=s+ int(score)
avg= s/n
#print average of the input
print ('average: ',avg)
<u>Output</u>:
58
96
34
15
stop
average: 50.75
Explanation:
<u>Following are the description of the program</u>.
- Firstly, set three variable that is 's' for sum, 'n' for count and 'avg' for average and initialize them to 0.
- Set the infinite while loop and inside it, set variable 'score' that get input from the user then, set the if conditional statement for break the loop, otherwise we calculate the sum of the user input and calculate its average.
- Finally, we print the result with message.