Day 17 of 30Real Python & Data
📚Modules & the Ecosystem
🎯 Today's objective
Reuse code with imports and install packages with pip.
📖 Key concepts
- import brings in modules
- Standard library: math, random, datetime, json
- pip install <package>
- The data/AI stack: numpy, pandas, matplotlib, scikit-learn
💻 Try this code
import math, datetime
print(math.sqrt(144))
print(datetime.date.today())
# In a terminal: pip install numpy pandas matplotlib scikit-learn👥 Learn it your way
🧒 Young Explorers
Modules are toolboxes other people built so you don’t have to start from scratch.
Your task
Use the math module to print √2, π, and the ceiling of 4.2.
💼 Professionals
Use virtual environments (venv) and a requirements.txt for reproducible setups.
Your task
Create a venv, install pandas, and print its __version__ from a script.
🤖 AI connection
Modern AI is built on shared libraries (PyTorch, TensorFlow, scikit-learn, transformers). Knowing how to import and install is how you stand on giants’ shoulders.
✅ Quick check
What does pip do?
Installs third-party Python packages.
Name one standard-library module.
e.g. math, random, datetime, json.