Skip to content

Commit dd6f406

Browse files
authored
Add files via upload
1 parent c878cc3 commit dd6f406

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

ex3.2FindingTheSquareRoot.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Find the square root
2+
3+
def average(a, b):
4+
return(a+b)/2
5+
6+
def squareRoot(num, low, high):
7+
for i in range(100):
8+
guess=average(low, high)
9+
if guess**2 > num:
10+
high=guess
11+
elif guess**2 < num:
12+
low=guess
13+
else:
14+
break
15+
print(guess)

0 commit comments

Comments
 (0)