python square root without math #2023
Python has an exponentiation operator (**) which can be used to calculate the power of a number. x**y returns x raised to y i.e. y times multiplication of x. Since we need to calculate the square root, y should be (1/2)
>>> 10**(1/2) 3.1622776601683795 >>> 25**(1/2) 5.0