CHAPTER 41   •   PYTHON

Python Import

Learn different ways to import Python functionality.

01 What is this?

Learn different ways to import Python functionality.

02 Syntax

Python Syntax
import module

03 Example

Python Example
import math
from math import sqrt

print(math.pi)
print(sqrt(25))

04 Important Points

You can import an entire module or specific members.

05 Common Mistakes

Avoid unnecessary imports.

06 Real World Use

Imports connect your program with libraries and modules.

07 Practice This Topic

Now try the example yourself in the AIFA Python Editor.

  • Read the example carefully.
  • Change the values.
  • Run the code.
  • Observe the output.
  • Try creating your own example.
Try It Yourself →