+ 1

Square root in python

How to use ** function to get square root of number. It says String cannot be converted to float.

3rd May 2022, 3:38 PM
Gouri
17 Antworten
+ 6
#if you not understood, see this : num = int( input() ) sq = num ** 0.5 print(sq)
4th May 2022, 2:02 PM
Jayakrishna 🇮🇳
+ 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.
4th May 2022, 12:45 PM
⚡parky
⚡parky - avatar
+ 2
n=int(input('Enter a base : ') m=int(input('Enter a root : ') x= n**(1/m) print(x)
5th May 2022, 12:07 AM
RAJNISH KUMAR SINGH
RAJNISH KUMAR SINGH - avatar
+ 1
Add your tried code here. ex: print( 25**(1/2))
4th May 2022, 10:49 AM
Jayakrishna 🇮🇳
+ 1
So using the example given it would result as 5 because 25 to the power of half is 5
4th May 2022, 12:46 PM
⚡parky
⚡parky - avatar
+ 1
It says lousy conversion from str to float
4th May 2022, 12:47 PM
Gouri
+ 1
Input() is accepted as string form default. So you need to convert to required type.. There convert to inter type..
4th May 2022, 12:57 PM
Jayakrishna 🇮🇳
+ 1
Thanks for the help :)
4th May 2022, 6:22 PM
Gouri
+ 1
I think its done for you ☺️
4th May 2022, 10:34 PM
Sumit Kumar
Sumit Kumar - avatar
+ 1
Import math x = int(input()) Print(math.sqrt(x))
5th May 2022, 6:48 AM
Emeku Abel🇳🇬
Emeku Abel🇳🇬 - avatar
+ 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
8th May 2022, 10:02 AM
RAJNISH KUMAR SINGH
RAJNISH KUMAR SINGH - avatar
+ 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..
8th May 2022, 10:09 AM
RAJNISH KUMAR SINGH
RAJNISH KUMAR SINGH - avatar
0
num = input() sq = num ** 0.5 print(sq)
4th May 2022, 12:47 PM
Gouri
0
Acg hhc nbvxnm
5th May 2022, 9:39 AM
Lokky Mone
0
print (x**0.5)
5th May 2022, 10:53 AM
Kyaw Moe Lwin
Kyaw Moe Lwin - avatar
0
import math
5th May 2022, 2:13 PM
Minhaj Noushad
0
Write a python3 function sqr( n ) that returns the square of its numeric parameter n.
30th Jun 2022, 11:30 AM
Ishaka Samarakkodi
Ishaka Samarakkodi - avatar