Type something to search...

Python Modules

Python Modules

Modules are files containing Python code that can be reused in other programs.

Importing a Module:

import math
print(math.sqrt(16))

Creating Your Own Module:

# my_module.py
def greet(name):
    print(f"Hello, {name}!")
# main.py
import my_module
my_module.greet("Alice")

Next Steps

In the next tutorial, we will explore Python Classes and Objects.

Next: Python Classes and Objects →