This commit is contained in:
2025-11-06 20:25:47 +01:00
parent 70dc9d6b73
commit 6e1a01665f
36 changed files with 169 additions and 348 deletions

View File

@@ -16,6 +16,78 @@ thumbnail: thumbnails/resized/e3f80df020cca3c2d7e2ffdc7d968e79_86cf658e.webp
- [ ] Beispiele planen
## Ablauf
- Comments
```python
# This is a Comment
"""This is a Docstring"""
'''This is also a Docstring'''
```
- Variablen
```python
var = 5 # a Variable which holds the Number 5
```
- Print
- String
- f-String
```python
'Single Quote String'
"Double Quote String"
txt = 'String'
f'This is a format-{txt}'
f"This is a format-{txt}"
```
- Datentypen
- Bool
- Int
- Float
```python
flag = True | False
num = 1 | -1
price = 3.141 | -inf
```
- Rechenoperationen
- Addition
- Subtraktion
- Multiplication
- Exponentiation
- Division
- Ganzzahldivision
- Ringarithmetik
```python
5 + 4 = 9
5.0 + 4 = 9.0
0.25 - 1 = -0.75
2*2 = 4
2**24 = 16.777.216
10 / 3 = 3.33
10 % 3 = 1
10 // 3 = 3
```
- If/Else
```python
if 4 < 3:
print(True)
elif 5 < 4:
print("Hello")
else:
num = 7
```
- For/While - Loop
```python
for i in range(0,10,2):
print(i)
i = 0
while i < 10:
print(i)
i += 2
```
- assert
```python
assert num > 3 "Num must be greater than 3"
```
## Beispiele
```python