Import

Domain: Programming Fundamentals

🎯 Motivation

Python has a huge ecosystem of pre-written code. Importing lets you use code others have written.

πŸ“‹ Concrete Example

import random gives you random.randint(1, 6) to roll a die. from math import sqrt gives you sqrt(16) = 4.

πŸ”— Analogy

Borrowing books from a library - instead of writing your own encyclopedia, you borrow one that’s already written and use the parts you need.