{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "f09b762d-ce55-4e77-9676-f089ba3ac5f1",
   "metadata": {},
   "source": [
    "# Python 101, Klausur 2026-01-10, 13:30 Uhr\n",
    "\n",
    "Prof. Dr. Johannes Busse\n",
    "\n",
    "(Aufgabengruppe a)\n",
    "\n",
    "ACHTUNG: Dieses Notebook ist ein erlaubtes Hilfsmittel. Es muss nicht benutzt werden, aber die Benutzung könnte helfen, die Papierklausur besser zu machen. Bewertungsrelevant ist ausschließlich die zugehörige Papierklausur."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2435a9d7-69d1-41c9-a114-7ce3af2be4da",
   "metadata": {},
   "source": [
    "# Aufgabe 1: Körpergrößen (a)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ce3dec8b-7f47-499f-8b29-9b1c240bcc7c",
   "metadata": {},
   "source": [
    "gegeben: Wir messen die Körpergrößen von Menschen in einem Hörsaal."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "17382007-d8ac-4bc7-9f00-a8ceb269dbec",
   "metadata": {},
   "outputs": [],
   "source": [
    "# m ... Messwerte Körpergröße in cm -- leider als String gegeben\n",
    "m = [ '180', '183', '177', '164', '167', '167']"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b110336f-9399-4583-9f75-6021d53f6e11",
   "metadata": {},
   "source": [
    "gesucht: durchschnittliche Körpergröße `schnitt`, kleinste Körpergröße `klein`, größte Körpergröße `gross` in der Gruppe."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "236b6498-9798-44bf-944a-015b6e611b45",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Ellipsis"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Ergebnis-Variablen definieren\n",
    "schnitt, klein, gross = 0,0,0\n",
    "\n",
    "# hier Ihre Programmierung\n",
    "... # "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "ea578959-d730-4db3-abd2-f07a61aa032e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'schnitt=173.0, klein=164, gross=183'"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Ihr Ergebnis\n",
    "ergebnis = f\"{schnitt=}, {klein=}, {gross=}\"\n",
    "ergebnis"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "b73cd29d-9e00-4564-84be-7ac1b85be877",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Test\n",
    "ergebnis == 'schnitt=173.0, klein=164, gross=183'"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "669038d6",
   "metadata": {},
   "source": [
    "# Aufgabe 2: String Maskieren (a)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "54c1ef47-4c61-4f3f-b8a3-9c8b81cb0d8b",
   "metadata": {},
   "source": [
    "gegeben: Ein String `s`, Beispiel:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "96373533-7256-4ab4-abcb-4bb95d83e9c4",
   "metadata": {},
   "outputs": [],
   "source": [
    "s = \"Hallo Erika Musterfrau!\""
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b8b225bc-a609-43ce-a406-d96f55e7536f",
   "metadata": {},
   "source": [
    "gesucht: Eine \"Maskierung\" des Strings, die dadurch entsteht, dass man alle Vokale (\"aeiou\") entfernt."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "03191b9c-1580-44b5-a586-b08ca00e272e",
   "metadata": {},
   "outputs": [],
   "source": [
    "s2 = {}\n",
    "vokale = \"aeiou\"\n",
    "\n",
    "# Hier Ihre Lösung:\n",
    "... # "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "cbd39089-34b8-4224-8214-46360ff5ed1d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'Hll Erk Mstrfr!'"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Ihr Ergebnis\n",
    "s2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "5f556d54-3c65-4b1a-98db-fc992eda1540",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Test\n",
    "s2 == 'Hll Erk Mstrfr!'"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6fb35c16-5537-4e40-98ac-07e0d3ab97ed",
   "metadata": {},
   "source": [
    "# Aufgabe 3: Quersumme (a)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a481a241-a004-4aba-b641-e224bf893c48",
   "metadata": {},
   "source": [
    "**Teil 1**\n",
    "\n",
    "gegeben: Eine Notebook-Zelle, die aus einer Integer-Zahl die (einfache) Quersumme berechnet:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "1aedb759-ba75-40f6-8870-133b91115d96",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "15"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "zahl = 12345\n",
    "quersumme = sum( int(ziffer) for ziffer in f\"{zahl}\" )\n",
    "quersumme"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e9eed579-68fe-4de1-af7b-65a8e9f89574",
   "metadata": {},
   "source": [
    "gesucht: Wir benötigen eine Funktion `quersumme(x)`, die diese Berechnung anstellt."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "666ff91b-f76c-4ed9-8655-e97e78306264",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Ihre Programmierung\n",
    "... #"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "a184edf7-5d71-4c1f-84b8-854dfe94a9a3",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "15\n"
     ]
    }
   ],
   "source": [
    "# Ihr Ergebnis\n",
    "print( quersumme(12345) )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "e9e5ffa7-c436-4920-9643-e59b5d0ab330",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Test\n",
    "quersumme(12345) == 15"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "18a1413b",
   "metadata": {},
   "source": [
    "**Teil2**\n",
    "\n",
    "gegeben: Eine Liste `l` von Zahlen:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "28346739",
   "metadata": {},
   "outputs": [],
   "source": [
    "l = [ 123, 2345, 34567 ]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e116821b",
   "metadata": {},
   "source": [
    "Gesucht: eine Liste `q`, die die Quersumme jeder Zahl in `l` enthält."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "f9416368",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Variable anlegen\n",
    "q = []\n",
    "\n",
    "# Ihre Programmierung\n",
    "... # "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "986d06a3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[6, 14, 25]"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Ihr Ergebnis\n",
    "q"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "011687da",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Test\n",
    "q == [6, 14, 25]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "83bb63c9-fbea-47da-9a6e-9caddaf8f9b4",
   "metadata": {},
   "source": [
    "# Aufgabe 4: Messwerte 2 CSV (a)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "61aed0e9-0fa8-46bb-ad9a-aafb4d3a48e0",
   "metadata": {},
   "source": [
    "gegeben: Eine Tabelle von Messwerten für Geschlecht, Körpergröße, Alter in zeilenweiser Darstellung."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "33f877b6-16a2-48ec-b9ed-886a9255142c",
   "metadata": {},
   "outputs": [],
   "source": [
    "werte = [\n",
    "    [ \"Geschlecht\", \"Körpergröße\", \"Alter\" ],\n",
    "    ['m', '180', '21'],\n",
    "    ['m', '183', '27'],\n",
    "    ['m', '177', '23'] ] "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1f4f350f-467e-44f9-8cee-cf9e49da2ca7",
   "metadata": {},
   "source": [
    "gesucht: ein einziger String, der diese Tabelle in Form einer CSV-Datei repräsentiert."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "6de7574a-0c77-43d6-b23b-0240a79cb135",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Variable definieren\n",
    "csv = \"\" \n",
    "\n",
    "# Ihre Lösung\n",
    "... # "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "dc114b04-54fc-4ff6-9c66-bb36c3913270",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Geschlecht;Körpergröße;Alter\n",
      "m;180;21\n",
      "m;183;27\n",
      "m;177;23\n"
     ]
    }
   ],
   "source": [
    "# Ihr Ergebnis\n",
    "print(csv)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "2f3dae04-5187-4d73-b05c-4baa57432732",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Test\n",
    "csv == \"\"\"Geschlecht;Körpergröße;Alter\n",
    "m;180;21\n",
    "m;183;27\n",
    "m;177;23\"\"\""
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f86e1e25-0c94-4ec7-ba6c-b90256251ebb",
   "metadata": {},
   "source": [
    "# Aufgabe 5: CSV 2 Familie (a)\n",
    "\n",
    "gegeben: In einer CSV-Datei sind Namen von Kinden und ihren Eltern gegeben. Wenn wir die Datei einlesen erhalten wir folgenden String `data`:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "1efbc05c",
   "metadata": {},
   "outputs": [],
   "source": [
    "data = \"\"\"Kind;Vater;Mutter\n",
    "Kain;Adam;Eva\n",
    "Ismail;Ibrahim;Hadschar\n",
    "Isaak;Abraham;Sara\"\"\""
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2e558256-2e8d-4a06-8458-2572ddcfe983",
   "metadata": {},
   "source": [
    "Gesucht: Wir benötigen eine Tabelle dieser Daten in der Form einer Liste von Listen, zeilenweise."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "0fc69420-d5e8-4bd6-8ba8-41d12e2c86c0",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Variable definieren\n",
    "table = []\n",
    "\n",
    "# Ihre Programmierung\n",
    "... # "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "2b3410ba-caa9-4297-8736-0a2b01d42bae",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[['Kind', 'Vater', 'Mutter'],\n",
       " ['Kain', 'Adam', 'Eva'],\n",
       " ['Ismail', 'Ibrahim', 'Hadschar'],\n",
       " ['Isaak', 'Abraham', 'Sara']]"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Ihr Ergebnise\n",
    "table"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "5a8d07d4-fbd3-444c-9e33-cc6015f2f7d2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Test\n",
    "table == [['Kind', 'Vater', 'Mutter'],\n",
    " ['Kain', 'Adam', 'Eva'],\n",
    " ['Ismail', 'Ibrahim', 'Hadschar'],\n",
    " ['Isaak', 'Abraham', 'Sara']]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "98ebf6e4",
   "metadata": {},
   "source": [
    "# Aufgabe 6: Textdatei Gedicht segmentieren (a)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "65ad90f6-93d4-4d8b-bd34-d8e0d71a5d77",
   "metadata": {},
   "source": [
    "gegeben ist ein schönes Gedicht als String."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "34cbf49c-fe18-479e-872b-c6565d4c54e2",
   "metadata": {},
   "outputs": [],
   "source": [
    "gedicht = \"\"\"Klarer Code fließt sanft,\n",
    "Python wird zu Poesie.\n",
    "Einfach, schön.\"\"\""
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9e3f3135-7fb8-42d5-81db-2904a008f463",
   "metadata": {},
   "source": [
    "gesucht: Zähle Zeilen und Wörter."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "35331104-6104-4f43-a61b-3e961eefa1d2",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Variablen definieren\n",
    "num_zeilen, num_woerter = 0, 0\n",
    "\n",
    "# hier Ihre Programmierung\n",
    "... # "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "8c2a688a-a093-4631-8f20-b62b7be5eebc",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'num_zeilen=3, num_woerter=10'"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Ihr Ergebnis\n",
    "f\"{num_zeilen=}, {num_woerter=}\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "f249ca87-942a-4e5d-bff3-b3fad7cc6766",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(True, True)"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Test\n",
    "num_zeilen ==3,  num_woerter == 10"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d2304080",
   "metadata": {},
   "source": [
    "# Aufgabe 7: String to List (a)\n",
    "\n",
    "gegeben: Ein Dict von Name und Geburtsdatum"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "8bbe426c-e10c-44d1-bb76-032b55b54d12",
   "metadata": {},
   "outputs": [],
   "source": [
    "# g ... Geburtstage\n",
    "g = { \"Anna\": \"2005-02-10\", \"Ben\": \"2004-02-23\", \"Charly\": \"2005-02-10\" }"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b03c22f5-df4d-4c7d-9a03-013359248a18",
   "metadata": {},
   "source": [
    "gesucht: Eine etwas höherwertige Repräsentation der Geburtstage als ein Dictionary von Listen."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "a32e6198-0adb-4a18-af12-73ad3d846556",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Ergebnis-Variable definieren\n",
    "g1 = {}\n",
    "\n",
    "# Hier die Lösung programmieren\n",
    "... # "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "bf3da38e-a6a1-4ff0-9b26-1a0540c4d2ad",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'Anna': ['2005', '02', '10'], 'Ben': ['2004', '02', '23'], 'Charly': ['2005', '02', '10']}\n"
     ]
    }
   ],
   "source": [
    "# Ihre Lösung\n",
    "print(g1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "e7eb0321-7602-44a8-a496-77288d7ec7da",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Test\n",
    "g1 == {'Anna': ['2005', '02', '10'], 'Ben': ['2004', '02', '23'], 'Charly': ['2005', '02', '10']} "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "194276b6",
   "metadata": {},
   "source": [
    "# Aufgabe 8: Geburtstagsdict (a, b)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e489f212",
   "metadata": {},
   "source": [
    "gegeben: Ein Dict von Name und Geburtsdatum. Das Geburtsdatum ist als Liste von Strings in der Form `[ jjjj, mm, tt ]` gegeben."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "cb1104b8",
   "metadata": {},
   "outputs": [],
   "source": [
    "# g2 ... Geburtstage\n",
    "g2 = {'Anna': ['2005', '02', '10'], 'Ben': ['2004', '02', '23'], 'Charly': ['2005', '02', '10']}"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ffee4bfe",
   "metadata": {},
   "source": [
    "gesucht: Eine noch höherwertige Repräsention der Geburtstage als ein Dictionary von Dictionaries."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "59810058",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Ergebnis-Variable definieren\n",
    "g3 = {}\n",
    "\n",
    "# Hier die Lösung programmieren\n",
    "... # "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "6cc0642e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'Anna': {'jahr': '2005', 'monat': '02', 'tag': '10'},\n",
       " 'Ben': {'jahr': '2004', 'monat': '02', 'tag': '23'},\n",
       " 'Charly': {'jahr': '2005', 'monat': '02', 'tag': '10'}}"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Ihre Lösung\n",
    "g3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "id": "ea3d97e6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Test \n",
    "g3 == {'Anna': {'jahr': '2005', 'monat': '02', 'tag': '10'},\n",
    " 'Ben': {'jahr': '2004', 'monat': '02', 'tag': '23'},\n",
    " 'Charly': {'jahr': '2005', 'monat': '02', 'tag': '10'}}"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d6f6a169-b472-4087-8037-669c1e8fddd9",
   "metadata": {},
   "source": [
    "# Aufgabe 9: Geburtstage im gleichen Jahr (a, b)\n",
    "\n",
    "gegeben: Eine (z.B. Excel- oder CSV-)Tabelle, die (z.B. mit Pandas) bereits eingelesen und in ein Dict aus Dicts überführt wurde:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "2fc190ba-4623-4e9d-8907-c7e0ac7a94a9",
   "metadata": {},
   "outputs": [],
   "source": [
    "# g3 ... Geburtstage als Dict von Dicts\n",
    "g3 = {'Anna': {'jahr': '2005', 'monat': '02', 'tag': '10'},\n",
    " 'Ben': {'jahr': '2004', 'monat': '02', 'tag': '23'},\n",
    " 'Charly': {'jahr': '2005', 'monat': '02', 'tag': '10'}}"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5d16cd41-e231-4164-b24c-42f33855bb73",
   "metadata": {},
   "source": [
    "Wir haben hier ja eine Abbildung von Person nach Geburtstag. \n",
    "\n",
    "gesucht:\n",
    "* Wir wollen zu jedem Jahr wissen, welche Personen in diesem Jahr Geburtstag haben. (Das ist eine Art Umkehr-Abbildung von `g3`).\n",
    "\n",
    "Die Datenstruktur des Ergebnisses soll das Dict `g3_invers` sein, das zu jedem Jahr eine Menge von Personen enthält, siehe unten \"Test\"."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "c3f80eef-c517-4da7-a7c8-81294be27faa",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Ergebnis-Variable definieren\n",
    "g3_invers = {}\n",
    "\n",
    "# hier Ihre Lösung\n",
    "... # \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "32f2733e-e48e-4652-bb70-e9f927c86b86",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'2005': {'Anna', 'Charly'}, '2004': {'Ben'}}"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Ihre Lösung\n",
    "g3_invers"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "7f1a16d3-9018-4adf-b9cd-6db5c0405959",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Test\n",
    "g3_invers == {'2005': {'Anna', 'Charly'}, '2004': {'Ben'}}"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
