Skip to content

Commit 80628ff

Browse files
improved cheatsheet
1 parent 44ea0ec commit 80628ff

File tree

2 files changed

+19
-40
lines changed

2 files changed

+19
-40
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@
33
/*/__pycache__
44
/_site/
55
/_freeze/
6-
_quarto_internal_scss_error.scss
6+
_quarto_internal_scss_error.scss
7+
.DS_Store
8+
*/.DS_Store

general/cheatsheet.qmd

Lines changed: 16 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
---
2-
title: "Lecture I - Introduction"
2+
title: "Cheatsheet"
33
subtitle: "Programming with Python"
44
author: "Dr. Tobias Vlćek"
5-
institute: "Kühne Logistics University Hamburg - Fall 2024"
65
title-slide-attributes:
76
data-background-color: "#FFE0D3"
87

@@ -16,44 +15,21 @@ format:
1615
documentclass: report
1716
---
1817

19-
# Cheatsheet
2018

2119
# Lecture I
2220

23-
---
24-
title: "Lecture I - Introduction"
25-
subtitle: "Programming with Python"
26-
author: "Dr. Tobias Vlćek"
27-
institute: "Kühne Logistics University Hamburg - Fall 2024"
28-
title-slide-attributes:
29-
data-background-color: "#FFE0D3"
30-
31-
execute:
32-
echo: true
33-
34-
format:
35-
html:
36-
theme: [litera, ../styles_html.scss]
37-
pdf:
38-
documentclass: report
39-
---
40-
41-
# Cheatsheet - Lecture I
42-
43-
## Key Concepts
44-
45-
### Python Basics
21+
## Python Basics
4622
- Python is an **interpreted language** - code is executed line by line
4723
- Comments start with `#`
4824
- Code blocks are defined by indentation
4925

50-
### Variables
26+
## Variables
5127
- Created using assignment operator `=`
5228
- Must start with letter or underscore
5329
- Case sensitive
5430
- Cannot use reserved words
5531

56-
### Data Types
32+
## Data Types
5733
1. **Strings (str)**
5834
- Enclosed in quotes: `"Hello"` or `'Hello'`
5935
- F-strings: `f"Value is {variable}"`
@@ -66,7 +42,7 @@ format:
6642
3. **Booleans (bool)**
6743
- `True` or `False`
6844

69-
### Basic Operators
45+
## Basic Operators
7046
```python
7147
# Arithmetic
7248
addition = 1 + 2 # 3
@@ -78,7 +54,7 @@ exponentiation = 9 ** 0.5 # 3.0
7854
modulo = 10 % 3 # 1
7955
```
8056

81-
### Common Functions
57+
## Common Functions
8258
```python
8359
# Input/Output
8460
print("Hello") # Display output
@@ -202,6 +178,8 @@ while True:
202178
4. Avoid infinite loops
203179
5. Keep code blocks focused and manageable
204180

181+
---
182+
205183
# Lecture III
206184

207185
## Functions
@@ -325,6 +303,8 @@ class Child(Parent):
325303
- variable_name (snake_case)
326304

327305

306+
---
307+
328308
# Lecture IV
329309

330310
## Tuples
@@ -440,6 +420,8 @@ with open("file.txt", "r") as file:
440420
5. Always use `with` statement for file operations
441421
6. Close files after use if not using `with`
442422

423+
---
424+
443425
# Lecture V
444426

445427
## Common Built-in Exceptions
@@ -540,9 +522,9 @@ assert x == expected_value, f"x should be {expected_value}, but got {x}"
540522
4. Test the fix
541523
5. Add error handling if needed
542524

543-
```
525+
---
544526

545-
# Cheatsheet - Lecture VI
527+
# Lecture VI
546528

547529
## Modules
548530

@@ -655,14 +637,9 @@ pip list
655637
5. Document package dependencies
656638
6. Use regular expressions carefully and test them thoroughly
657639

658-
## Common Errors
659-
- **ImportError**: Module not found
660-
- **ModuleNotFoundError**: Package not installed
661-
- **AttributeError**: Module attribute not found
662-
- **re.error**: Invalid regular expression pattern
663-
- **PermissionError**: File access denied
640+
---
664641

665-
# Cheatsheet - Lecture VII
642+
# Lecture VII
666643

667644
## NumPy Basics
668645

0 commit comments

Comments
 (0)