0Pricing
Learn AI with Python · Lesson

Importing Modules

Learn how to use Python's rich library of modules and build your own.

1

Introduction to Importing Modules

Modules are files containing Python code that can include functions, variables, and classes. By importing modules, you can reuse code and extend Python's functionality.

In this lesson, you’ll learn how to import and use built-in and custom modules.

Importing Modules — illustration 1

2

What Are Modules?

A module is a file containing Python code. You can use modules to organize code into reusable pieces. Python comes with built-in modules, and you can create your own as well.

Examples of built-in modules include:

  • math: Provides mathematical functions.
  • random: Generates random numbers.
  • os: Interacts with the operating system.

All lessons in this course

  1. What is a Function?
  2. Return Values
  3. Scope and Lifetime of Variables
  4. Built-in Functions vs. User-Defined Functions
  5. Importing Modules
← Back to Learn AI with Python