// blog
Articles
All
Basics
Control Flow
Functions
Data Structures
Modules & Packages
Projects
Object-oriented programming
|
↑ oldest first
↓ newest first
// Modules & Packages
What If I Could Make My Own Module?
The problem...
You have functions that work. Functions you've tested, functions you trust.
And you keep copying them from one script to another.
There's a better way.
The idea…
→
// Modules & Packages
Modules Mini Project — Write Once, Import Everywhere
What you're building
Three files. One module with shared functions. Two scripts that import from it independently.
The same function. Written once. Used everywhere.
What you ne…
→
// Modules & Packages
Modules — The Full Picture
You've covered the modules that matter most at this level. Before moving on, here's everything in one place.
// What you already knew
import random
random.randint(1, 10) …
→
// Modules & Packages
The Toolkit Is Stocked
You didn't write any of this.
That's the point.
Random numbers. Statistical averages. Timestamps. Countdowns. Character sets. Frequency counts. Grouped data without the boilerpl…
→