Modules & Imports (import, from, as, custom modules, name) - Python Tutorial #17

3views
1likes
0
10:29
T
Taught by Celeste AI - AI Coding Coach
View on YouTube
Description
Learn Python modules and imports in this beginner-friendly tutorial! ๐Ÿ“ฆ In this lesson, you will learn: โœ… import to load entire modules (math, os, platform) โœ… from...import to pick specific functions โœ… import...as to create shorter aliases โœ… Exploring modules with dir() โœ… Creating custom modules (helpers.py) โœ… Three import styles: import, from, and as โœ… Module-level constants (PI) โœ… The __name__ == "__main__" guard โœ… Multi-file projects with imports โœ… Mini Project: Unit Converter ๐Ÿ• Timestamps: 0:00 - Introduction 0:22 - Import Basics Explained 0:46 - Import Basics Demo 3:15 - Custom Modules Explained 3:39 - Custom Modules Demo 6:31 - Unit Converter Explained 6:55 - Unit Converter Demo 9:48 - Recap 10:23 - End ๐Ÿ’ป Source Code: https://github.com/GoCelesteAI/python_modules_imports ๐Ÿ“š Code from this lesson: # Import entire module import math print(math.sqrt(144)) # Import specific functions from random import randint, choice print(randint(1, 10)) # Import with alias import datetime as dt now = dt.datetime.now() # Custom module (helpers.py) def greet(name): return f"Hello, {name}!" # Using custom module from helpers import greet print(greet("Alice")) # __name__ guard if __name__ == "__main__": print("Running directly") ๐Ÿ”— Previous: Lesson 16 - Exception Handling ๐Ÿ”— Next: Lesson 18 - Classes & Objects #Python #PythonTutorial #LearnPython #Programming #Modules #Imports #PythonModules #CustomModules #PythonBasics
Back to tutorials

Duration

10:29

Published

February 9, 2026

Added to Codegiz

March 15, 2026

๐Ÿ“– Read the articleOpen in YouTube