{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "# ws2026-woche02.ipynb\n",
        "\n",
        "### Montag"
      ],
      "id": "3cf53463-f767-421f-a784-efa9d47e6456"
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {},
      "outputs": [
        {
          "output_type": "display_data",
          "metadata": {},
          "data": {
            "text/plain": [
              "[2, 3, 5, 7]"
            ]
          }
        }
      ],
      "source": [
        "L = [2, 3, 5, 7]\n",
        "L"
      ],
      "id": "c5395b06"
    },
    {
      "cell_type": "code",
      "execution_count": 2,
      "metadata": {},
      "outputs": [
        {
          "output_type": "display_data",
          "metadata": {},
          "data": {
            "text/plain": [
              "[2, 3, 5, 7]"
            ]
          }
        }
      ],
      "source": [
        "L2 = L\n",
        "L2"
      ],
      "id": "43f0650b"
    },
    {
      "cell_type": "code",
      "execution_count": 3,
      "metadata": {},
      "outputs": [
        {
          "output_type": "display_data",
          "metadata": {},
          "data": {
            "text/plain": [
              "[2, 3, 5, 7, 11]"
            ]
          }
        }
      ],
      "source": [
        "L.append(11)\n",
        "L"
      ],
      "id": "69f03ecd"
    },
    {
      "cell_type": "code",
      "execution_count": 4,
      "metadata": {},
      "outputs": [
        {
          "output_type": "display_data",
          "metadata": {},
          "data": {
            "text/plain": [
              "[2, 3, 5, 7, 11]"
            ]
          }
        }
      ],
      "source": [
        "L2"
      ],
      "id": "62d6d71b"
    },
    {
      "cell_type": "code",
      "execution_count": 5,
      "metadata": {},
      "outputs": [],
      "source": [
        "L.append(13)"
      ],
      "id": "60d2d7e0"
    },
    {
      "cell_type": "code",
      "execution_count": 6,
      "metadata": {},
      "outputs": [
        {
          "output_type": "display_data",
          "metadata": {},
          "data": {
            "text/plain": [
              "[2, 3, 5, 7, 11, 13]"
            ]
          }
        }
      ],
      "source": [
        "L"
      ],
      "id": "66a60390"
    },
    {
      "cell_type": "code",
      "execution_count": 7,
      "metadata": {},
      "outputs": [
        {
          "output_type": "display_data",
          "metadata": {},
          "data": {
            "text/plain": [
              "[2, 3, 5, 7, 11, 13, ['a', 'b', 'c']]"
            ]
          }
        }
      ],
      "source": [
        "L.append( [ \"a\", \"b\", \"c\" ] )\n",
        "L"
      ],
      "id": "532841e4"
    },
    {
      "cell_type": "code",
      "execution_count": 8,
      "metadata": {},
      "outputs": [
        {
          "output_type": "display_data",
          "metadata": {},
          "data": {
            "text/plain": [
              "[2, 3, 5, 7, 11, 13, ['a', 'b', 'c'], 'x', 'y', 'z']"
            ]
          }
        }
      ],
      "source": [
        "L.extend( [ \"x\", \"y\", \"z\" ] )\n",
        "L"
      ],
      "id": "bb9f24ee"
    },
    {
      "cell_type": "code",
      "execution_count": 9,
      "metadata": {},
      "outputs": [
        {
          "output_type": "display_data",
          "metadata": {},
          "data": {
            "text/plain": [
              "[2, 3, 5, 7, 11, 13, ['a', 'b', 'c'], 'x', 'y', 'z']"
            ]
          }
        }
      ],
      "source": [
        "L2"
      ],
      "id": "3369db66"
    },
    {
      "cell_type": "code",
      "execution_count": 10,
      "metadata": {},
      "outputs": [
        {
          "output_type": "display_data",
          "metadata": {},
          "data": {
            "text/plain": [
              "[2, 3, 5, 7, 11, 13, ['a', 'b', 'c'], 'x', 'y', 'z', 1000, 1001, 1002]"
            ]
          }
        }
      ],
      "source": [
        "L = L + [ 1000, 1001, 1002 ]\n",
        "L"
      ],
      "id": "35756f11"
    },
    {
      "cell_type": "code",
      "execution_count": 11,
      "metadata": {},
      "outputs": [],
      "source": [
        "L2.reverse()"
      ],
      "id": "b75c4b2e"
    },
    {
      "cell_type": "code",
      "execution_count": 12,
      "metadata": {},
      "outputs": [
        {
          "output_type": "display_data",
          "metadata": {},
          "data": {
            "text/plain": [
              "['z', 'y', 'x', ['a', 'b', 'c'], 13, 11, 7, 5, 3, 2]"
            ]
          }
        }
      ],
      "source": [
        "L2"
      ],
      "id": "3f0e6edb"
    },
    {
      "cell_type": "code",
      "execution_count": 13,
      "metadata": {},
      "outputs": [],
      "source": [
        "numbers = {'one':1, 'two':2, 'three':3}"
      ],
      "id": "ae8fbd50"
    },
    {
      "cell_type": "code",
      "execution_count": 14,
      "metadata": {},
      "outputs": [
        {
          "output_type": "display_data",
          "metadata": {},
          "data": {
            "text/plain": [
              "{'one': 1, 'two': 2, 'three': 3}"
            ]
          }
        }
      ],
      "source": [
        "numbers"
      ],
      "id": "f7739384"
    },
    {
      "cell_type": "code",
      "execution_count": 15,
      "metadata": {},
      "outputs": [
        {
          "output_type": "display_data",
          "metadata": {},
          "data": {
            "text/plain": [
              "{'one': 1, 'two': 2, 'three': 3, (1, 2, 3): [1, 11, 111]}"
            ]
          }
        }
      ],
      "source": [
        "numbers[ (1, 2, 3) ] = [ 1, 11, 111 ] \n",
        "numbers"
      ],
      "id": "63577d16"
    },
    {
      "cell_type": "code",
      "execution_count": 16,
      "metadata": {},
      "outputs": [],
      "source": [
        "# wirft einen Fehler\n",
        "# numbers[ [1, 2, 3] ] = [1, 22, 333 ]"
      ],
      "id": "ed7deb03"
    },
    {
      "cell_type": "code",
      "execution_count": 17,
      "metadata": {},
      "outputs": [
        {
          "output_type": "display_data",
          "metadata": {},
          "data": {
            "text/plain": [
              "{'one': 1, 'two': 2, 'three': 3, (1, 2, 3): [1, 11, 111]}"
            ]
          }
        }
      ],
      "source": [
        "numbers"
      ],
      "id": "6a88169b"
    },
    {
      "cell_type": "code",
      "execution_count": 18,
      "metadata": {},
      "outputs": [
        {
          "output_type": "display_data",
          "metadata": {},
          "data": {
            "text/plain": [
              "{1, 2}"
            ]
          }
        }
      ],
      "source": [
        "s = { 1, 2, 1}\n",
        "s"
      ],
      "id": "bbe0f2f3"
    },
    {
      "cell_type": "code",
      "execution_count": 19,
      "metadata": {},
      "outputs": [],
      "source": [
        "s = { 3, 2, 1,1,1}"
      ],
      "id": "376bb30b"
    },
    {
      "cell_type": "code",
      "execution_count": 20,
      "metadata": {},
      "outputs": [
        {
          "output_type": "display_data",
          "metadata": {},
          "data": {
            "text/plain": [
              "set"
            ]
          }
        }
      ],
      "source": [
        "s = {1}\n",
        "type(s)"
      ],
      "id": "a9e4c4dc"
    },
    {
      "cell_type": "code",
      "execution_count": 21,
      "metadata": {},
      "outputs": [
        {
          "output_type": "display_data",
          "metadata": {},
          "data": {
            "text/plain": [
              "list"
            ]
          }
        }
      ],
      "source": [
        "type( L )"
      ],
      "id": "d1d98ad1"
    },
    {
      "cell_type": "code",
      "execution_count": 22,
      "metadata": {},
      "outputs": [
        {
          "output_type": "display_data",
          "metadata": {},
          "data": {
            "text/plain": [
              "str"
            ]
          }
        }
      ],
      "source": [
        "type( \"Hallo\" )"
      ],
      "id": "0f1b1623"
    },
    {
      "cell_type": "code",
      "execution_count": 23,
      "metadata": {},
      "outputs": [
        {
          "output_type": "display_data",
          "metadata": {},
          "data": {
            "text/plain": [
              "dict"
            ]
          }
        }
      ],
      "source": [
        "s = {}\n",
        "type( s )"
      ],
      "id": "f3890afe"
    },
    {
      "cell_type": "code",
      "execution_count": 24,
      "metadata": {},
      "outputs": [],
      "source": [
        "s = set()"
      ],
      "id": "d1ed1666"
    },
    {
      "cell_type": "code",
      "execution_count": 25,
      "metadata": {},
      "outputs": [
        {
          "output_type": "display_data",
          "metadata": {},
          "data": {
            "text/plain": [
              "set"
            ]
          }
        }
      ],
      "source": [
        "type(s)"
      ],
      "id": "e289bcf1"
    },
    {
      "cell_type": "code",
      "execution_count": 26,
      "metadata": {},
      "outputs": [
        {
          "output_type": "display_data",
          "metadata": {},
          "data": {
            "text/plain": [
              "[2, 3, 5, 7, 11, 13, ['a', 'b', 'c'], 'x', 'y', 'z', 1000, 1001, 1002]"
            ]
          }
        }
      ],
      "source": [
        "L"
      ],
      "id": "3f80d4ae"
    },
    {
      "cell_type": "code",
      "execution_count": 27,
      "metadata": {},
      "outputs": [
        {
          "output_type": "display_data",
          "metadata": {},
          "data": {
            "text/plain": [
              "['H', 'a', 'l', 'l', 'o']"
            ]
          }
        }
      ],
      "source": [
        "L3 = list(\"Hallo\")\n",
        "L3"
      ],
      "id": "c3135b1e"
    },
    {
      "cell_type": "code",
      "execution_count": 28,
      "metadata": {},
      "outputs": [
        {
          "output_type": "display_data",
          "metadata": {},
          "data": {
            "text/plain": [
              "{'H', 'a', 'l', 'o'}"
            ]
          }
        }
      ],
      "source": [
        "set ( list ( \"Hallo\" ) )"
      ],
      "id": "1f465fca"
    },
    {
      "cell_type": "code",
      "execution_count": 29,
      "metadata": {},
      "outputs": [],
      "source": [
        "L4 = [ 1, 2, 3 ]"
      ],
      "id": "b1aed1e3"
    },
    {
      "cell_type": "code",
      "execution_count": 30,
      "metadata": {},
      "outputs": [
        {
          "output_type": "display_data",
          "metadata": {},
          "data": {
            "text/plain": [
              "[1, 2, 3, 99]"
            ]
          }
        }
      ],
      "source": [
        "L4.append(99)\n",
        "L4"
      ],
      "id": "ecb2c4fc"
    },
    {
      "cell_type": "code",
      "execution_count": 31,
      "metadata": {},
      "outputs": [
        {
          "output_type": "display_data",
          "metadata": {},
          "data": {
            "text/plain": [
              "(1, 2, 3)"
            ]
          }
        }
      ],
      "source": [
        "T = ( 1, 2, 3 )\n",
        "T"
      ],
      "id": "036bb46c"
    },
    {
      "cell_type": "code",
      "execution_count": 32,
      "metadata": {},
      "outputs": [],
      "source": [
        "# wirft einen Fehler\n",
        "# T.append(99)"
      ],
      "id": "216c6240"
    },
    {
      "cell_type": "code",
      "execution_count": 33,
      "metadata": {},
      "outputs": [],
      "source": [
        "a = 1\n",
        "b = 2"
      ],
      "id": "9d892ee6"
    },
    {
      "cell_type": "code",
      "execution_count": 34,
      "metadata": {},
      "outputs": [
        {
          "output_type": "display_data",
          "metadata": {},
          "data": {
            "text/plain": [
              "(1, 2)"
            ]
          }
        }
      ],
      "source": [
        "a, b"
      ],
      "id": "827d3b61"
    },
    {
      "cell_type": "code",
      "execution_count": 35,
      "metadata": {},
      "outputs": [],
      "source": [
        "(a, b) = (b, a)"
      ],
      "id": "1db1ae88"
    },
    {
      "cell_type": "code",
      "execution_count": 36,
      "metadata": {},
      "outputs": [
        {
          "output_type": "display_data",
          "metadata": {},
          "data": {
            "text/plain": [
              "(2, 1)"
            ]
          }
        }
      ],
      "source": [
        "a, b"
      ],
      "id": "730f168c"
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "### Dienstag"
      ],
      "id": "00d70404-a10e-4123-9bef-f1dfa2d00301"
    },
    {
      "cell_type": "code",
      "execution_count": 37,
      "metadata": {},
      "outputs": [
        {
          "output_type": "display_data",
          "metadata": {},
          "data": {
            "text/plain": [
              "-15"
            ]
          }
        }
      ],
      "source": [
        "x = -15\n",
        "x"
      ],
      "id": "f9a6cc33"
    },
    {
      "cell_type": "code",
      "execution_count": 38,
      "metadata": {},
      "outputs": [
        {
          "output_type": "display_data",
          "metadata": {},
          "data": {
            "text/plain": [
              "True"
            ]
          }
        }
      ],
      "source": [
        "x > -20"
      ],
      "id": "e6b064f8"
    },
    {
      "cell_type": "code",
      "execution_count": 39,
      "metadata": {},
      "outputs": [
        {
          "output_type": "display_data",
          "metadata": {},
          "data": {
            "text/plain": [
              "1"
            ]
          }
        }
      ],
      "source": [
        "wahrfalsch = 1\n",
        "wahrfalsch"
      ],
      "id": "f412bac1"
    },
    {
      "cell_type": "code",
      "execution_count": 40,
      "metadata": {},
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            " Trffer!\n",
            "Gratulation!"
          ]
        }
      ],
      "source": [
        "if wahrfalsch:\n",
        "    print(\" Trffer!\")\n",
        "    print(\"Gratulation!\")\n",
        "else:\n",
        "    print(\"leider, leider ...\")"
      ],
      "id": "1bd0332f"
    },
    {
      "cell_type": "code",
      "execution_count": 41,
      "metadata": {},
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "4\n",
            "9\n",
            "25"
          ]
        }
      ],
      "source": [
        "for x in [ 2, 3, 5]:\n",
        "    y = x*x\n",
        "    print(y)"
      ],
      "id": "3624a204"
    },
    {
      "cell_type": "code",
      "execution_count": 42,
      "metadata": {},
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "4\n",
            "9\n",
            "25"
          ]
        }
      ],
      "source": [
        "quelle = [ 2, 3, 5]\n",
        "\n",
        "for x in quelle:\n",
        "    y = x*x\n",
        "    print(y)"
      ],
      "id": "cefe9a64"
    },
    {
      "cell_type": "code",
      "execution_count": 43,
      "metadata": {},
      "outputs": [],
      "source": [
        "# wirft einen Fehler\n",
        "# ergebnis == [ 4, 9, 25 ]"
      ],
      "id": "673b52dc"
    },
    {
      "cell_type": "code",
      "execution_count": 44,
      "metadata": {},
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "4\n",
            "9\n",
            "25"
          ]
        },
        {
          "output_type": "display_data",
          "metadata": {},
          "data": {
            "text/plain": [
              "False"
            ]
          }
        }
      ],
      "source": [
        "quelle = [ 2, 3, 5]\n",
        "ergebnis = []\n",
        "\n",
        "for x in quelle:\n",
        "    y = x*x\n",
        "    print(y)\n",
        "\n",
        "ergebnis == [ 4, 9, 25 ]"
      ],
      "id": "24412044"
    },
    {
      "cell_type": "code",
      "execution_count": 45,
      "metadata": {},
      "outputs": [
        {
          "output_type": "display_data",
          "metadata": {},
          "data": {
            "text/plain": [
              "[4, 9, 25, 100, 121, 144]"
            ]
          }
        }
      ],
      "source": [
        "quelle = [ 2, 3, 5, 10, 11, 12]\n",
        "ergebnis = []\n",
        "\n",
        "for x in quelle:\n",
        "    y = x*x\n",
        "    # print(y, end=\": \")\n",
        "    ergebnis.append(y)\n",
        "    #print(ergebnis)\n",
        "    \n",
        "ergebnis"
      ],
      "id": "8cf7889b"
    },
    {
      "cell_type": "code",
      "execution_count": 46,
      "metadata": {},
      "outputs": [
        {
          "output_type": "display_data",
          "metadata": {},
          "data": {
            "text/plain": [
              "[4, 9, 25, 100, 121, 144]"
            ]
          }
        }
      ],
      "source": [
        "quelle = [ 2, 3, 5, 10, 11, 12]\n",
        "ergebnis = []\n",
        "\n",
        "for x in quelle:\n",
        "    ergebnis.append( x*x )\n",
        "    \n",
        "ergebnis"
      ],
      "id": "9ffd7761"
    },
    {
      "cell_type": "code",
      "execution_count": 47,
      "metadata": {},
      "outputs": [
        {
          "output_type": "display_data",
          "metadata": {},
          "data": {
            "text/plain": [
              "[4, 9, 25, 100, 121, 144]"
            ]
          }
        }
      ],
      "source": [
        "quelle = [ 2, 3, 5, 10, 11, 12]\n",
        "\n",
        "#for x in quelle:\n",
        "#    ergebnis.append( x*x )\n",
        "    \n",
        "ergebnis = [  x*x  for x in quelle  ]\n",
        "ergebnis"
      ],
      "id": "68375443"
    }
  ],
  "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"
    }
  }
}