import math

This import statement causes Python to use the math package with your program. The math package has many special functions. The one we need here is sqrt. Remember that you need very specific commands in order to use mathematical functions in python as in the value of the square root of a variable for example. To know what they are called and how to use them refer to math . You can either scan it or search for the function you are looking for.

import sys

on the other hand, here we are importing sys to be able to exit the code earlier. Refer to the exiting part of the explanation for more details.