HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Glossary
  2. /Python and data
  3. /Import (Python modules and libraries)

What is Import (Python modules and libraries)?

In short

A module is a file of ready-made Python code, and a library is a collection of modules. The import command lets your program use them.

In simple words

The standard library comes with Python. Examples are math for x\sqrt{x}x​, sin⁡x\sin xsinx and π\piπ, random for random numbers, and statistics for means and standard deviations. Outside libraries such as NumPy and Matplotlib are installed once and then imported in the same way. A common habit is import numpy as np, which gives the library a short name.

Example

This prints 1.4142135623730951 3.141592653589793.

Learn it properly

  • Lessons on this topic
  • Test yourself

Related terms

  • NumPy Array
  • Function (in Python)

← All glossary terms

Learn it in

  1. Import a Toolbox: ModulesClass 9 to 10
All lessons on this topic →

Practise

  1. A shop sells these items on one day, with the prices [20, 25, 25, 30, 22, 28, 400]…Easy
  2. Roll two dice 6000 times, with the seed 3…Medium
  3. Which module would you use for each job? …Easy
  4. Find out, with dir and help, which function of math gives the sine of an angle, and…Easy

Quick questions

  1. A package pkg has two files, and the program main.py sits beside the package folder.…Hard
  2. The module shapes.py sets __all__. The program main.py imports from it with a star.…Advanced
  3. Four rounding results are tested after the math module is imported. Which comparisons…Advanced

More Python and data terms

  1. Cell (in a Python notebook)
  2. Class and Special Methods (in Python)
  3. Dictionary (in Python)
  4. For Loop
  5. If Statement (in Python)
  6. List (in Python)
All Python and data terms →

Try it yourself

Python labs run in your browser. Type the code, run it and see what happens.

Open a Python lab