The Python math library contains a "sqrt(x)" function that returns the square root of a number. Another option is to type "x**(0.5)", which returns the same value.
Continue ReadingUsing the "math.sqrt(x)" function requires importing the math library by including the line "import math" somewhere in the program. The command "from math import sqrt" allows users to use the command "sqrt(x)" and does not import other math functions, which reduces memory usage.
While it might be less readable, the "x**(0.5)" notation does not require any preceding commands to function properly. However, it is important that the number used in this command is a floating point value. "x**(1/2)" doesn't work correctly in Python 2, although it works in Python 3. "x**(1.0/2.0)" works with both platforms.
Learn more about Computer Programming