Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions book/Week1/input_to_output.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ In **Python** we mostly work with data input:

A typical program takes this input, does what you want, and then returns the output.

![Demo hello world](../figures/Week1/input_output_image.png)

## Variables
The whole point of input, is that it may be different every time you run your program. We need a place to store it so we can refer to it at a later time. This is what **variables** are for.

Expand Down
43 changes: 36 additions & 7 deletions book/Week1/what_is_python.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# What does Python do
In the beginning, computers were programmed manually. If a programmer wanted to automate something using a computer, they had to put all kinds of switches in the right order for the program to run and work.

Luckily, we live in a day and age where everything is now digital.
Luckily, we live in a day and age where everything can be done digitally.

## Machine code and compiled languages
Computers only understand specific instructions. *Move this data here* or *Add this value and this value together*. The programmers that used to program in instructions like those were practically wizards. They would be able to deduce what the following program does just by looking at it:
Expand Down Expand Up @@ -29,23 +29,52 @@ _start:
```

## How Python is different
Python is build on layers and layers of other programming code that takes care of all the details and boring stuff. Because of that, the code that was shown above in Assembly can be written in Python like this:
Python is a programming language that is build on layers and layers of other programming code that takes care of all the details and boring stuff. Because of that, the code that was shown above in Assembly can be written in Python like this:

```Python
print("Hello World")
```

Only one line of code is enough. This will show, or **return**, the phrase "Hello World" to the person that runs this bit of code.
A single line of code is enough. This will show, or **return**, the phrase "Hello World" to the person that runs this bit of code.

That is in essence how Python works. You give it a line of code, Python:
- **interprets** the code
- **returns** the outcome
- **moves** to the next line of code
1. **interprets** the code
2. **returns** the outcome
3. **moves** to the next line of code

Thus, when you give it two lines of code, it will run the first, and then the second. This means if you write the following:

```Python
print("one")
print("two")
```
Python will return "one", followed by "two".
Python will return `one`, followed by `two`.

## Running Python code
There are many different ways to run, or **execute**, Python code. In this course we will get you acquainted with a few of them:
- By using Python directly
- By writing a Python script and running it
- By using Jupyter Notebooks

In preparation to this course you installed **Anaconda**, which is an overarching application to help you out with Python. If you managed to install Anaconda correctly, you can open Python by typing the following commands in your Command Prompt (Windows) or Terminal (MacOS):

```
conda activate base
python
```

If all went well, you should something similar to this:

```
Python 3.13.9 | packaged by Anaconda, Inc. | (main, Oct 21 2025, 19:11:29) [Clang 20.1.8 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
```

Now you can type any Python code you want, and Python will run it. It is perfect for experimenting with smaller pieces of code that you don't necessarily want to save. You can always exit Python to return to your console by using the `exit()` command.

Try it out yourself with the **Hello World** example from above.

![Demo hello world](../figures/Week1/demo_hello_world.gif)

It is good to see this, because it is the basis of every Python program ever written. The Python interpreter goes over the code line by line and performs actions based on what's written. No matter whether you're using the interpreter directly, through a script, or through Jupyter Notebooks. This is the very core of any Python program.
20 changes: 10 additions & 10 deletions book/Week1/why_and_how.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ But how do you tell a computer what to do so it can only be interpreted in **one

## Programming Code

Everything you do on a computer, be it your laptop, your phone, your smartwatch, is only made possible through programming code.
- You hit a like button?
- Code is *executed* to make the like counter go up by one
- You ignore your mum calling you?
- Code is *executed* so she gets your voicemail instead
- You are reading this very sentence?
- Code was *executed* to get it from my keyboard to your eyes
Everything you do on a computer, be it on your laptop, on your phone, on your smartwatch, is only made possible through programming code telling your device what to do.

My point is, that programming code is everywhere, programmers and designers have just gotten much better at hiding it exists.
**You hit a like button?** → Code is *executed* to make the like counter go up by one

If you want to get the most out of your computer, if you want to make it do stuff nobody has thought of before, want to automate some process, or are simply too lazy to do stuff by hand:
**You ignore your mum calling you?** → Code is *executed* so she gets your voicemail instead

**Learning to code will open those doors for you**.
**You are reading this very sentence?** → Code was *executed* to get it from my keyboard to your eyes

My point is, that programming code is everywhere, programmers and designers have just gotten much better at hiding it exists. But, if you want to get the most out of your computer, if you want to make it do stuff nobody has thought of before, want to automate some process, or are simply too lazy (/smart) to do stuff by hand:

<span style="font-size:larger;"> Learning to code will open those doors for you!</span>

So let's get started
Binary file added book/figures/Week1/demo_hello_world.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added book/figures/Week1/input_output_image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading