Introduction

1. Introduction#

Hide code cell source

import sys
from pathlib import Path

current = Path.cwd()
for parent in [current, *current.parents]:
    if (parent / '_config.yml').exists():
        project_root = parent  # ← Add project root, not chapters
        break
else:
    project_root = Path.cwd().parent.parent

sys.path.insert(0, str(project_root))

from shared import thinkpython, diagram, jupyturtle, download

# # Register as top-level modules so direct imports work in subsequent cells
sys.modules['thinkpython'] = thinkpython
sys.modules['diagram'] = diagram
sys.modules['jupyturtle'] = jupyturtle
sys.modules['download'] = download
../../_images/python-coffee-pour-mugs.jpeg

Fig. 1.1 (from Python Developer )#

Welcome to this introduction to Python and programming. In this chapter, you’ll get a high-level view of what programming is, how Python fits into the broader computing landscape, and which ideas you’ll rely on throughout the book. You’ll also learn where to find setup guidance for the command line interface (CLI), Python, and Jupyter Notebooks, so you can write, run, and experiment with Python code effectively.

Learning programming is largely about connecting the dots. First, you need enough concepts, examples, and practice problems to work with. Then you need to connect them so they become usable knowledge.

Two habits matter early:

  1. Repeat: Keep collecting and revisiting the core ideas.

  2. Associate: Keep linking new ideas to examples you already understand.

../../_images/knowledge-experience-creativity.jpg

Fig. 1.2 Experience, Knowledge, and Creativity #

Python is a practical first language because it lets you focus on problem solving without fighting the syntax too early. Its readability, broad standard library, and large ecosystem also make it useful beyond beginner exercises, including automation, scripting, data analysis, and software development.

By the end of this chapter, you should be able to:

  • explain what programming is at a high level

  • describe how Python fits into the broader computing landscape

  • distinguish conceptual ideas from Python-specific syntax

  • identify where to find environment and Jupyter setup guidance

  • start reading simple Python code with the right expectations

This chapter has two sections. 0101-programming introduces the core ideas behind programming, such as abstraction, programming languages, and how code expresses logic. 0102-basic-syntax then shows how those ideas appear in Python through code structure, statements, input and output, comments, and modules.

A useful way to read these sections is in sequence: first build a mental model of what programs are doing, then learn the Python syntax used to express those ideas.

If you still need to set up Python, the command line, or Jupyter Notebook, use the appendices as your reference while working through this chapter.

Next, start with 0101-programming. Once the big picture is clear, continue to 0102-basic-syntax to see those ideas in actual Python code.