Python 1.1.0 Help

Library Installation and Importing - Examples

Importing

  1. Importing the entire Library and all of the included functionality

import math print(math.sqrt(16))
  1. Importing only a specific function (In this case the function for square rooting)

from math import sqrt print(sqrt(16))
  1. Importing the library under a different label

import math as mt print(mt.sqrt(16))
  1. Combining the label and specific function

from math import sqrt as st print(st(16))
Last modified: 25 May 2024