find the square root of a number in python

To find the square root of a number in Python, you can use the math.sqrt() function. Here's an example code snippet that shows how to use it:

main.py
import math

number = 16
sqrt = math.sqrt(number)
print("The square root of", number, "is", sqrt)
98 chars
6 lines

In this example, we're importing the math module and then using the sqrt() function to find the square root of the number 16. We then print out the result using a formatted string that includes the original number and its square root.

gistlibby LogSnag