Python Program to Import from module

In the following example of Python program that demonstrates how to import a function from a module :
Program :
# Importing a function from a module
from math import sqrt

# Using the imported function
x = 16
print("The square root of", x, "is", sqrt(x))
Output :
The square root of 16 is 4.0
In the above program, we first import the `sqrt` function from the `math` module using the `from...import` statement. This makes the `sqrt` function available to us in our program. We can then use the `sqrt` function to calculate the square root of the number 16 and print the result to the console.

Note that when we use the `from...import` statement, we don't need to prefix the function name with the module name when we use it in our code. We can simply use the function name directly, as we did in the `print` statement.