10 Antworten
+ 3
there are two more ways currently I can refer(without using sqrt())
x = int(input())
import math
print(pow(x, 0.5))
or,
print(x**0.5)
+ 4
A very god question tho
+ 1
You can for instance say; root = Number**2.
but why don't you want to use math.sqrt or one-half power? I see two main reasons to avoid that: when you need more precision than the rest significant digits that math.sqrt and one-half power provide, or you are working with large integers and you want an exact answer for the integer part of the square root.
+ 1
Try this new method without using sqrt() and pow()
num = float(input("Enter num: "))
a = 1.0
while(1):
b = a*a
if num-0.1 < b < num+0.1 :
break
else:
pass
a = a + 0.01
print("\n Square root value is: ",round(a,2))
Hope its helpful
0
No, it isn't a homework question, a thought just passed through my mind and I couldn't find the anwer to it myself, even though it was easy😅
0
# square root
a=int(input("enter no."))
b=a**0.5
print(b)
- 1
https://www.geeksforgeeks.org/square-root-of-an-integer/
Check that out.
- 1
x**0.5