added tut 11
This commit is contained in:
@ -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": []
|
||||
}
|
||||
```
|
Reference in New Issue
Block a user