added tut 11

This commit is contained in:
2024-01-11 03:07:13 +01:00
parent 70b33e4198
commit cdd5008d65

View File

@ -13,8 +13,45 @@ Dictionary, List-Comprehensions, Funktionen als Objekte
---
# Dictionary
## Dictionary
- Eine Ansammlung aus **Keys** und dessen **Werten**
- Ordnet jedem **Key** einen **Wert** zu
-
- Ein **Key** muss **immutable** sein, also keine `list`, `Objects`, ...
- **Werte** können mutable sein, also eigentlich alles.
---
### Creating a Dictionary
```python
dictionary = {
<key>: <value>,
<key>: <value>,
...
<key>: <value>
}
```
---
### Creating a Dictionary
```python
dictionary = {
<key>: <value>,
<key>: <value>,
...
<key>: <value>
}
```
#### Beispiel
```python
courses = {
"eidp": ["np163", "az34", "jf334"],
"mathe": ["aw331", "pl67"],
"sdp": []
}
```