+ 1
Square root in python
How to use ** function to get square root of number. It says String cannot be converted to float.
17 odpowiedzi
+ 6
#if you not understood, see this :
num = int( input() )
sq = num ** 0.5
print(sq)
+ 2
Jayakrishain
Good example because if you have a number to the power of a half then it will output the square root of that answer.
+ 2
n=int(input('Enter a base : ')
m=int(input('Enter a root : ')
x= n**(1/m)
print(x)
+ 1
Add your tried code here.
ex:
print( 25**(1/2))
+ 1
So using the example given it would result as 5 because 25 to the power of half is 5
+ 1
It says lousy conversion from str to float
+ 1
Input() is accepted as string form default. So you need to convert to required type.. There convert to inter type..
+ 1
Thanks for the help :)
+ 1
I think its done for you ☺️
+ 1
Import math
x = int(input())
Print(math.sqrt(x))
+ 1
lst=[int(x) for x in input().split()]
sqrlst=[x**0.5 for x in lst]
print("Square root of numbers entered : ",*sqrlst)
###Run it once...it will help u alot
+ 1
lst=[int(x) for x in input().split()]
sqrlst=[round(x**0.5,2) for x in lst]
print("Square root of numbers entered : ",*sqrlst)
###Run it once....if u want to fix output up to 2 decimal..
0
num = input()
sq = num ** 0.5
print(sq)
0
Acg hhc nbvxnm
0
print (x**0.5)
0
import math
0
Write a python3 function sqr( n ) that returns the square of its numeric parameter n.