Library Installation and Importing - Examples
Importing
Importing the entire Library and all of the included functionality
import math
print(math.sqrt(16))
Importing only a specific function (In this case the function for square rooting)
from math import sqrt
print(sqrt(16))
Importing the library under a different label
import math as mt
print(mt.sqrt(16))
Combining the label and specific function
from math import sqrt as st
print(st(16))
Last modified: 25 May 2024