A Brief Introduction to import

In Python, the import keyword allows you to include modules in your program and use their functionalities directly in your code. This feature enables you to organize your code into reusable components spread into modules and packages.

Python import Keyword Examples

Here’s an example to demonstrate how you can use the import keyword in Python:

Language: Python
>>> import math
>>> math.sqrt(16)
4.0

In this example, the import math statement makes the math module available, allowing you to call its sqrt() function to compute the square root of 16.

Locked learning resources

Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Already a member? Sign-In

Locked learning resources

The full lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Already a member? Sign-In

You must own this product to join the conversation.