Python

Python Fundamentals

Introduction to Python & Setup

Python is a high-level, interpreted, general-purpose programming language created by Guido van Rossum, first released in 1991.

JrCodex·5 min read

Jr Codex Python Notes

Level: Beginner Prerequisites: None Time to complete: ~20 minutes


Table of Contents

  1. What is Python?
  2. Why Python is So Popular
  3. Installing Python
  4. Ways to Run Python Code
  5. Your First Program
  6. Choosing an Editor
  7. Summary & Next Steps

1. What is Python?

Python is a high-level, interpreted, general-purpose programming language created by Guido van Rossum, first released in 1991.

"High-level"   → You write code close to human language, not machine instructions.
"Interpreted"  → Code runs line-by-line via an interpreter, no separate compile step.
"General-purpose" → Not tied to one domain — web, data, AI, scripting, automation, all fit.

Compared to a lower-level language like C, Python trades some raw speed for a massive gain in readability and development speed:

# Python — reads almost like English
name = "Alice"
print(f"Hello, {name}!")
// C — same idea, far more ceremony
#include <stdio.h>
int main() {
    char name[] = "Alice";
    printf("Hello, %s!\n", name);
    return 0;
}

ReasonExplanation
Readable syntaxUses indentation instead of {}, minimal boilerplate
Batteries includedHuge standard library (files, math, dates, networking...)
Huge ecosystempip gives access to 500,000+ third-party packages
Cross-domainWeb (Django, Flask), Data (pandas, NumPy), AI (PyTorch, transformers)
Beginner-friendlyGentle learning curve, used as a first language at most universities

This is exactly why the rest of the Jr Codex curriculum — Machine Learning, Deep Learning, and NLP/LLMs — is built entirely on Python.


3. Installing Python

Windows

  1. Download the installer from python.org/downloads.
  2. Important: check "Add python.exe to PATH" during install.
  3. Verify in a terminal:
python --version
# Python 3.12.x

macOS / Linux

Python 3 often comes pre-installed, but it's usually outdated. Recommended: install via a version manager.

# macOS (Homebrew)
brew install python3
 
# Linux (Debian/Ubuntu)
sudo apt update && sudo apt install python3 python3-pip

Verifying pip (Python's package manager)

pip --version
# pip 24.x from ... (python 3.12)

4. Ways to Run Python Code

There are three common ways to execute Python, and you'll use all three throughout this course.

MethodUse Case
REPL (interactive shell)Quick experiments, testing one-liners
Script file (.py)Real programs, reusable code
Notebook (.ipynb)Data exploration, mixing code with notes/plots (used heavily in later ML/DL modules)

The REPL

Type python in your terminal to enter the Read-Eval-Print Loop:

$ python
>>> 2 + 2
4
>>> print("testing")
testing
>>> exit()

Running a Script

# hello.py
print("Hello from a script!")
$ python hello.py
Hello from a script!

Jupyter Notebooks

pip install notebook
jupyter notebook

This opens a browser-based environment where you run code in cells — the standard tool for data science work later in this curriculum.


5. Your First Program

Create a file named greet.py:

# greet.py
def greet(name):
    """Return a friendly greeting."""
    return f"Hello, {name}! Welcome to Python."
 
if __name__ == "__main__":
    user_name = input("What's your name? ")
    print(greet(user_name))

Run it:

$ python greet.py
What's your name? Alice
Hello, Alice! Welcome to Python.

Don't worry about understanding def or if __name__ == "__main__" yet — functions are covered fully in Module 2. For now, just get comfortable running files.


6. Choosing an Editor

You don't need anything fancy to start:

ToolBest For
VS CodeMost popular, free, great Python extension
PyCharmFull-featured IDE, strong for larger projects
Jupyter/ColabData science, notebooks, no local setup (Colab runs in-browser)

Recommendation for this course: VS Code with the official Python extension — it's what most of the code examples in later chapters assume.


7. Summary & Next Steps

Key Takeaways

  • Python is a readable, interpreted, general-purpose language — the foundation for every later module in this curriculum (ML, DL, NLP/LLMs).
  • You can run Python via the REPL (quick tests), scripts (.py files), or notebooks (.ipynb, used in data science work).
  • pip is Python's package manager — you'll use it constantly starting in Module 3.

Concept Check

  1. What does "interpreted" mean, and how is it different from a "compiled" language?
  2. Name the three ways to run Python code covered in this chapter.
  3. What command checks your installed Python version?

Next Chapter

Chapter 2: Variables, Data Types & Type Conversion


Jr Codex — 1-on-1 Personalized Coaching | Back to Module Index