Python: How to Find the square root and square of numbers (Several methods)

Method 1: use the built-in module

>>> import math

>>> math.pow(12, 2)     # Request Square
144.0

>>> math.sqrt(144)      # Find the square root
12.0

>>>

Method 2: use expression

>>> 12 ** 2             # Request Square
144

>>> 144 ** 0.5          # Find the square root
12.0

>>> 

Method 3: use built-in function

>>> pow(12, 2)          # Request Square
144

>>> pow(144, .5)        # Find the square root
12.0

>>>

Read More: