Knaph

Modules and imports

Splitting a program into files that others can import, so a function is written once and used everywhere - plus the standard library that comes with Python and the packages others share.

Depth 1 · Foundation

You can put functions in a module and import them three ways, guard test code with if __name__ == "__main__", use math, random (with a seed), datetime and collections.Counter, and know what pip and PyPI are for.

Sign in to prove what you know with a short quiz, see how deep you've gone, and earn XP for it.

Sign in with Google

Depths of understanding

  1. 1

    Foundation

    You can put functions in a module and import them three ways, guard test code with if __name__ == "__main__", use math, random (with a seed), datetime and collections.Counter, and know what pip and PyPI are for.

Your path here

What's still between you and Modules and imports, depth 1, in the order you can learn it.

  1. 1ProgramDepth 1 · Foundation · Program Basics
  2. 2ExpressionDepth 1 · Foundation · Program Basics
  3. 3Variables in codeDepth 1 · Foundation · Program Basics
  4. 4Program stateDepth 1 · Foundation · Program Basics
  5. 5Input and outputDepth 1 · Foundation · Program Basics
  6. 6Functions in codeDepth 1 · Foundation · Functions
  7. 7Modules and importsDepth 1 · Foundation · Organizing Programs

Where it fits