{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "# Python 101 LN1\n",
        "\n",
        "s-mmuster\n",
        "\n",
        "Name: Mustermann, Max Studiengang: WIF\n",
        "\n",
        "## Aufgabe 1\n",
        "\n",
        "Gegeben ein String und eine Whitelist von erlaubten Buchstaben,\n",
        "Beispiel:"
      ],
      "id": "3490d3f5-eb77-4cd0-8d07-3c7e60794eb6"
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {},
      "outputs": [],
      "source": [
        "text = \"Hallo, Otto!\"\n",
        "whitelist = \"abcdefghijklmnopqrstuvwxyzaäüß\""
      ],
      "id": "a79463ac"
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "Gesucht: ein “normalisierter”, d.h. leicht vereinfachter String:\n",
        "\n",
        "- Schritt 1: Alle Großbuchstaben werden zuerst in Kleinbuchstaben\n",
        "  übersetzt\n",
        "- Schritt 2: In das Ergebnis werden nur Zeichen aus der Whitelist\n",
        "  übernommen\n",
        "\n",
        "Vorgehen im Jupyter Lab:\n",
        "\n",
        "### (1) zuerst in einzelnen Zellen entwickeln"
      ],
      "id": "14bc7267-30a5-472a-82ca-c6ce59a0780d"
    },
    {
      "cell_type": "code",
      "execution_count": 2,
      "metadata": {},
      "outputs": [
        {
          "output_type": "display_data",
          "metadata": {},
          "data": {
            "text/plain": [
              "Ellipsis"
            ]
          }
        }
      ],
      "source": [
        "..."
      ],
      "id": "63f8c029"
    },
    {
      "cell_type": "code",
      "execution_count": 3,
      "metadata": {},
      "outputs": [
        {
          "output_type": "display_data",
          "metadata": {},
          "data": {
            "text/plain": [
              "Ellipsis"
            ]
          }
        }
      ],
      "source": [
        "..."
      ],
      "id": "5f08f36c"
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "### (2) als Funktion definieren\n",
        "\n",
        "Wenn es läuft die Berechnung verallgemeinern. d.g. als Funktion\n",
        "definieren:"
      ],
      "id": "224cc47f-b3f5-478d-93bc-6cbe0346f1cc"
    },
    {
      "cell_type": "code",
      "execution_count": 4,
      "metadata": {},
      "outputs": [],
      "source": [
        "def normalisiere_string(s1, erlaubt):\n",
        "    ... # \n",
        "    ... # \n",
        "    ... # "
      ],
      "id": "15673dc6"
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "Funktion mit den Beispieldaten aufrufen:"
      ],
      "id": "3b4a4818-2c08-4af2-8ed5-81ab5777acd7"
    },
    {
      "cell_type": "code",
      "execution_count": 5,
      "metadata": {},
      "outputs": [],
      "source": [
        "normalisiere_string(text, whitelist)"
      ],
      "id": "f2358182"
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Aufgabe 2\n",
        "\n",
        "**Gegeben** ist das Notebook [howto \\>\n",
        "buchstabenhaeufigkeit](../howto/buchstabenhaeufigkeit.qmd).\n",
        "\n",
        "Auftrag:\n",
        "\n",
        "- Texte vorher normalisieren, siehe Aufgabe 1\n",
        "- Die Buchstabenzählung als Funktion `zaehle_buchstaben(text)`\n",
        "  definieren"
      ],
      "id": "e2d980de-3325-4bcb-a22a-f42e00f902cc"
    }
  ],
  "nbformat": 4,
  "nbformat_minor": 5,
  "metadata": {
    "jupytext": {
      "notebook_metadata_filter": "jupytext",
      "text_representation": {
        "extension": ".qmd",
        "format_name": "quarto",
        "format_version": "1.0",
        "jupytext_version": "1.19.5"
      }
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3 (ipykernel)",
      "language": "python"
    },
    "language_info": {
      "name": "python",
      "codemirror_mode": {
        "name": "ipython",
        "version": "3"
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.12.3"
    }
  }
}