Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

How we express ideas as code

In the previous section, you saw why programming matters for working with data. Now, we move one step closer to practice:

The goal is orientation. You do not need to remember every term yet. By the end of the section, you should have a clear picture of how ideas become code and how we will work with Python throughout the course.


1. What programming means

Programming means giving a computer precise instructions to process data and produce results.

A computer does not interpret or guess. It follows the steps you write, exactly and repeatedly. The art of programming is to decide what steps are needed, in which order, and under which conditions. Programming is structured thinking. Before we write code, we clarify logic.

Coding and programming

You will hear the words coding and programming used almost interchangeably.

In this course, we do both:

The focus is not on building large applications. Instead, we use code as a practical tool to:

Even short programs can already be useful. A few lines of code can load a dataset, calculate a summary, and produce a clear visualisation.


2. Why Python in this course

Python is the programming language we use throughout this course.

There are many languages, but Python is particularly suitable for scientific and spatial work. It combines a gentle learning curve with strong tools for serious data analysis.

Examples of printing “Hello, world!” in different programming languages.

Examples of printing “Hello, world!” in different programming languages. Credit: GeoPython

Why Python fits our goals

Python works well for this course because it:

In practice this means you can focus on questions and workflows, not on low level technical details.

Popular programming languages.

Figure showing the most popular programming languages from the survey on The State of Spatial Data Science - 2024. Credit: Carto

What this means for you

You do not need to know any of these technical terms now. What matters is:


3. Ways to run Python code

There is more than one way to write and run Python code. Each option has its strengths, and you will encounter several during your studies.

In this course we mainly use notebooks, but it helps to know what else exists.

Scripts

Python scripts are plain text files with the file extension .py.

They are well suited for:

To run a script, you typically call Python from your Integrated Development Environment, a terminal or from a Python interpreter.

Example of a Python script file.

Example of a Python script file.

Scripts are common in software development and production systems. For learning and exploration they can feel less transparent, because the explanation, results, and code often live in separate places.

Notebooks

Jupyter notebooks combine several elements in a single interactive document:

Notebook files have the extension .ipynb. They are divided into cells. Each cell has a specific purpose:

You run the notebook in a web browser, while a Jupyter server executes the code in the background. The server can run on your computer or on a remote machine.

Elements of a Jupyter Notebook.

Elements of a Jupyter Notebook. Credit: GeoPython


This capability of combining code and documentation makes them ideal for:

You can read the explanation, run the code below it, and immediately see the output. If something is unclear, you can change one line at a time and observe what happens.

An example Jupyter Notebook.

An example Jupyter Notebook. Credit: GeoPython

In summary, notebooks enable you to document your process, display your code and results, and interpret your output, all within a single document. This makes them especially powerful for data science. A notebook can describe a complete workflow, from the initial data to the final findings. Because all steps are visible and executable, others can reproduce your work. This transparency is an important part of modern scientific practice.

Integrated Development Environments (IDEs)

An Integrated Development Environment (IDE) is a software application designed to help you write and manage code more efficiently.

Compared to the simple Python interpreter, IDEs provide many tools in one place, such as:

IDEs can look complex at first, but they can also be very helpful. Many IDEs highlight syntax errors immediately and suggest fixes, which makes it easier to learn and debug your code.

Several popular IDEs are used for Python:

You do not need to master an IDE right away. In this course, we focus on JupyterLab as a baseline. In addition, we encourage you to explore Visual Studio Code for its advanced tools when you start with your projects.
At this stage, the focus now is learning how to think in code, not mastering development tools.


4. Jupyter in this course

Jupyter is the system that allows notebooks to run in a web browser.

From your perspective, you open a notebook in a tab, write code in cells, and run them. In the background, a Jupyter server executes the Python code and sends the results back to your browser. That server can run:

In all cases, the experience in the browser is very similar.

JupyterLab

JupyterLab is the main interface we use in this course.

It is a browser based environment where you can:

When you start JupyterLab, it opens in a browser window and shows these components in a single workspace.


How to start JupyterLab

If you installed Miniconda, the typical workflow looks like this:

  1. Open a terminal

  2. Navigate to your working directory, for example:

    cd path/to/your/project-folder
  3. Create and activate your environment (once you installed Conda)

    conda create -n sds-env python=3.14
    conda activate sds-env
  4. Install and start JupyterLab

    conda install jupyterlab
    jupyter lab

Your browser will open automatically. JupyterLab will show the contents of the folder from which you started it.


How to stop JupyterLab

When you are finished:

  1. Go back to the terminal where JupyterLab is running.

  2. Press:

    Control + C
  3. Confirm with y if prompted.

Then optionally deactivate the environment:

conda deactivate

The Jupyter server will stop, and the browser tab can be closed.



The starting window of JupyterLab

The JupyterLab starting window


6. Summary

In this section, you learned how ideas become executable code.

You now understand that:

Most importantly, you should understand that programming in this course is not about building large software systems. It is about:


Looking ahead

In the next section, we move from concepts to structure and learn the basic rules that make Python code valid and readable. The aim is to write Python that the computer can understand. Here, small details matter:

In the next section, you will learn the core rules of Python syntax.
These rules are about writing code that is clear, consistent, and easy to debug.

Once you understand the syntax, you can start turning ideas into working programs.