From cdd5008d65cb97503d82f6618583c803288ed2c8 Mon Sep 17 00:00:00 2001 From: Nils Pukropp Date: Thu, 11 Jan 2024 03:07:13 +0100 Subject: [PATCH] added tut 11 --- Tutorium/tut11/README.md | 41 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/Tutorium/tut11/README.md b/Tutorium/tut11/README.md index e1b4220..b0ef6f8 100644 --- a/Tutorium/tut11/README.md +++ b/Tutorium/tut11/README.md @@ -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 = { + : , + : , + ... + : +} +``` + +--- + +### Creating a Dictionary + +```python +dictionary = { + : , + : , + ... + : +} +``` + +#### Beispiel + +```python +courses = { + "eidp": ["np163", "az34", "jf334"], + "mathe": ["aw331", "pl67"], + "sdp": [] +} +``` \ No newline at end of file