Plenty of π
Module 1: Introduction to Python and Computer Programming
Compilation vs. Interpretation

Computers don't understand human-readable programming languages directly. Code needs to be translated into machine code (binary instructions) that the computer's processor can execute. There are two main ways this translation happens:

  • Compilation: A compiler translates the entire program into machine code before it runs. This creates an executable file. Examples: C++, Java (compiles to bytecode, then interpreted by JVM).

    • Pros: Often faster execution once compiled.
    • Cons: Entire program needs to be recompiled after changes.
  • Interpretation: An interpreter reads and executes the code line by line. No separate executable file is created. Python is primarily an interpreted language.

    • Pros: Easier to test and debug, more flexible.
    • Cons: Can be slower than compiled languages for CPU-intensive tasks.