Skip to content

Commit 3079a86

Browse files
committed
Added a new lesson on programming languages in general.
1 parent ffd2cb0 commit 3079a86

10 files changed

Lines changed: 103 additions & 31 deletions
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
id: programming-languages
3+
title: What is a programming language?
4+
sidebar_label: 2. What is a programming language?
5+
sidebar_position: 2
6+
---
7+
8+
# What is a programming language?
9+
10+
Think of a **programming language** as a bridge between humans and computers. Computers don't understand English or Spanish; they only understand electricity (on or off). A programming language allows us to write instructions in a way that humans can read, which then get translated into something the computer can execute.
11+
12+
At its heart, programming is about two things: **Data** (the information) and **Algorithms** (the instructions).
13+
14+
## Data Structures: Organizing Information
15+
Before a computer can process information, it needs to organize it. This is called a **Data Structure**.
16+
17+
Imagine you are organizing a kitchen. You put eggs in a carton, flour in a jar, and milk in a jug. Each container is "structured" to hold that specific type of item efficiently.
18+
* **Simple Example:** A "Floating Point" number is just a fancy name for a decimal (like `1.45`).
19+
* **Built-in Types:** Most languages, including Python, have these "containers" ready for you to use (like integers, text, or lists).
20+
* **Custom Structures:** As you get more advanced, you can build your own "containers" to fit the specific needs of your app.
21+
22+
## Algorithm: The Step-by-Step Recipe
23+
An **algorithm** is simply a list of steps to finish a task. If you have ever followed a recipe to bake a cake, you have executed an algorithm!
24+
25+
In programming, an algorithm must be:
26+
1. **Finite:** It has a clear beginning and end.
27+
2. **Well-defined:** Each step is precise so the computer doesn't get confused.
28+
29+
## Language Elements
30+
Every language has a set of rules that determine if your code will actually run.
31+
32+
### 1. Syntax (The Grammar)
33+
Just like English has rules (sentences start with a capital letter and end with a period), programming has **Syntax**. If you forget a colon or a parenthesis in Python, the computer will give you a "Syntax Error" because it doesn't recognize the "sentence" you wrote.
34+
35+
### 2. Semantics (The Meaning)
36+
Syntax is about the *form*, but Semantics is about the *meaning*.
37+
* **Static Semantics:** These are rules checked before the program runs (like making sure you aren't trying to "multiply" a word by a color).
38+
* **Dynamic Semantics:** This is what actually happens while the program is running. It’s the "behavior" of your code.
39+
40+
### 3. Type System
41+
The **Type System** categorizes data so the computer knows what it can do with it. For example, you can add two numbers together ($2 + 2 = 4$), but you can't necessarily "add" a number to a list of names.
42+
43+
* **Static vs. Dynamic:** Python uses **Dynamic Typing**. This means you don't have to tell the computer "this is a number" beforehand; it figures it out while the program is running.
44+
* **Strong vs. Weak:** Python is **Strongly Typed**. It won't let you do "weird" things—like adding the number `5` to the word `"Apple"`—without you explicitly converting them first.
45+
46+
---
47+
48+
## Programming Paradigms (Styles of Coding)
49+
A "paradigm" is just a style or approach to writing code. Two of the most common are:
50+
51+
* **Imperative:** You give the computer a list of direct commands. "Go to the fridge, get the milk, pour it in a glass."
52+
* **Procedural:** Organizing those commands into "blocks" or functions.
53+
* **Object-Oriented (OOP):** Organizing code by grouping data and actions together (like creating a "Car" object that has data like "Color" and actions like "Drive").
54+
* **Declarative:** You describe *what* you want, but not exactly *how* to do it (like a GPS—you give it the address, and it figures out the turns).
55+
56+
### Which one is Python?
57+
Python is a "Multi-paradigm" language. This is why it is so popular for beginners! You can write simple lists of instructions (Imperative), or you can build complex systems using Objects (OOP).
58+
59+
## Next steps
60+
Now that we are familiar with *programming languages* in general, its time to move on to our target. The **Python** programming language.

curriculum/01-foundations/02-why-python.md renamed to curriculum/01-foundations/03-why-python.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
---
22
id: why-python
33
title: What is Python
4-
sidebar_label: 2. What is Python
5-
sidebar_position: 2
4+
sidebar_label: 3. What is Python
5+
sidebar_position: 3
66
---
7+
## What is a programming language?
8+
A programming language is a formal language to define **data structures** and **algorithms**. It is used to instruct a machine to perform a well-defined task. Most languages also provide means to **control the program flow**, that is the order in which the instructions of an algorithm are executed. The instructions itself are build according to grammar of the programming language, called the **syntax**.
9+
10+
### Data Structure
11+
Data structures are used to organize information in a way that enables efficient access and modification of the data. A simple example is a floating point number where the respective information is an actual number, such as `1.45`. A programming language offers a way to store the number and it offers operators on it, e.g. summation and multiplication. How the number is actually stored in memory and how the operations are performed is hidden away from the programmer. A floating point number is, in most programming languages, a build-in data type which means that it is readily available to the programmer. Many programming languages also allow to create new data structures, based on existing ones. This allows the programmer to design application specific data structures.
12+
13+
### Algorithm
14+
A algorithm is a finite sequence of well-defined instructions to solve a problem or to perform a computation. The concept of an algorithm is quite old and exists since the antique, e.g. in the form of arithmetic algorithms such as the [Euclidean algorithm](https://en.wikipedia.org/wiki/Euclidean_algorithm) to compute the greatest common divisor. Since the order of execution of the instructions are well-defined, algorithms can be easily implemented in a machine executable way which is one task of the programmer.
15+
16+
717
# Why Should You Use Python?
818

919
**Python** is a versatile, high-level programming language designed with a clear philosophy: code should be as easy to read as it is to write. Because its syntax closely mimics the English language, it removes the "language barrier" between your ideas and the computer, making it an ideal choice for beginners and professionals alike.

curriculum/01-foundations/03-print-function.md renamed to curriculum/01-foundations/04-print-function.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
id: print-function
33
title: The Print Function
4-
sidebar_label: 3. The Print Function
5-
sidebar_position: 3
4+
sidebar_label: 4. The Print Function
5+
sidebar_position: 4
66
---
77

88
# The Print Function: Recording Your First Entry
@@ -71,7 +71,7 @@ Everything after `#` is considered a comment.
7171
```
7272

7373
<details>
74-
<summary>Read more about `print()` function</summary>
74+
<summary>📚 Deep Dive</summary>
7575

7676
`print()` function has a few other arguments that you can use to further format your text on the screen.
7777

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
id: variables
33
title: Variables
4-
sidebar_label: 4. Variables
5-
sidebar_position: 4
4+
sidebar_label: 5. Variables
5+
sidebar_position: 5
66
---
77

88
# Variables: Labeling the Ledger
@@ -75,17 +75,7 @@ Let's use variables to build a mini "Character Sheet" for your coding journey.
7575
---
7676

7777
<details>
78-
<summary>Read more about variables</summary>
79-
80-
`print()` function has a few other arguments that you can use to further format your text on the screen.
81-
82-
Full function signiture is as follows:
83-
```python
84-
print(*objects, sep=' ', end='\n', file=None, flush=False)
85-
```
86-
87-
To learn more about this specific function and its arguments, visit:
88-
* [Official python documentation](https://docs.python.org/3/library/functions.html#print)
78+
<summary>📚 Deep Dive</summary>
8979

9080
Other resources:
9181
* [Geomar.de: Variables and Assignment](https://2025-pherwiss-2-945e87.pages.geomar.de/content/02_python_basics/02_variables_assignments.html)

curriculum/01-foundations/05-data-types.md renamed to curriculum/01-foundations/06-data-types.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
id: data-types
33
title: Data Types
4-
sidebar_label: 5. Data Types
5-
sidebar_position: 5
4+
sidebar_label: 6. Data Types
5+
sidebar_position: 6
66
---
77

88
# Data Types: Sorting the Ledger
@@ -72,9 +72,9 @@ You are auditing your supply of "Coding Fuel."
7272
---
7373

7474
<details>
75-
<summary>Read more about primitive data types</summary>
75+
<summary>📚 Deep Dive</summary>
7676

77-
These represent the smallest possible unit of information that can be stored.
77+
Primitive data types represent the smallest possible unit of information that can be stored.
7878
In python, these are the ones listed above, as well as `complex` which is used for scientific calculations and wont be part of this course.
7979

8080
To learn more about primitive data types in python, visit:

curriculum/01-foundations/06-numbers-and-math.md renamed to curriculum/01-foundations/07-numbers-and-math.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
---
22
id: numbers-and-math
33
title: Numbers and Math
4-
sidebar_label: 6. Numbers and Math
5-
sidebar_position: 6
4+
sidebar_label: 7. Numbers and Math
5+
sidebar_position: 7
6+
67
---
78

89
# Numbers and Math: Balancing the Ledger
@@ -79,6 +80,17 @@ You are calculating the final balance of a ledger entry after a year of 5% inter
7980

8081
---
8182

83+
<details>
84+
<summary>📚 Deep Dive</summary>
85+
86+
Other resources:
87+
* [Python Docs: Numeric Types](https://docs.python.org/3/library/stdtypes.html#numeric-types-int-float-complex)
88+
* [Programiz: Python Operators](https://www.programiz.com/python-programming/operators)
89+
* [Geomar.de: Primitive Data Types](https://2025-pherwiss-2-945e87.pages.geomar.de/content/02_python_basics/04_primitive_data_types.html)
90+
* [Pieriantraining.com: Python primitive data types - a comprehensive tutorial](https://pieriantraining.com/python-primitive-data-types-a-comprehensive-tutorial/)
91+
92+
</details>
93+
8294
## 📚 Deep Dive
8395
* [Python Docs: Numeric Types](https://docs.python.org/3/library/stdtypes.html#numeric-types-int-float-complex)
8496
* [Programiz: Python Operators](https://www.programiz.com/python-programming/operators)

curriculum/01-foundations/07-comparisons.md renamed to curriculum/01-foundations/08-comparisons.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
id: comparisons
33
title: Comparison Operators
4-
sidebar_label: 7. Comparisons
5-
sidebar_position: 7
4+
sidebar_label: 8. Comparisons
5+
sidebar_position: 8
66
---
77

88
# Comparisons: Auditing the Ledger

curriculum/01-foundations/08-if-statements.md renamed to curriculum/01-foundations/09-if-statements.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
id: if-statements
33
title: If Statements
4-
sidebar_label: 8. If Statements
5-
sidebar_position: 8
4+
sidebar_label: 9. If Statements
5+
sidebar_position: 9
66
---
77

88
# If Statements: The Fork in the Road
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
id: loops
33
title: Loops
4-
sidebar_label: 9. Loops
5-
sidebar_position: 10
4+
sidebar_label: 10. Loops
5+
sidebar_position: 11
66
---
77

88
# 🐍 Welcome to the Loop Zone! Python `for` and `while` Loops

curriculum/01-foundations/project-1-text-adventure.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
id: project-1-text-adventure
33
title: "Project 1: The Ledger of Fate"
44
sidebar_label: "🏆 Project 1: Text Adventure"
5-
sidebar_position: 9
5+
sidebar_position: 10
66
---
77

88
# 🏆 Project 1: The Ledger of Fate

0 commit comments

Comments
 (0)