{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "8cf932df-5bd0-49a9-a5aa-eecd3013c52f",
   "metadata": {},
   "source": [
    "# Vorlesung am 30.10.2024"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "6888baab-2ef2-4970-a50f-2b70a0b0a278",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-10-30T10:37:49.012942Z",
     "iopub.status.busy": "2024-10-30T10:37:49.012571Z",
     "iopub.status.idle": "2024-10-30T10:37:49.291868Z",
     "shell.execute_reply": "2024-10-30T10:37:49.291214Z",
     "shell.execute_reply.started": "2024-10-30T10:37:49.012915Z"
    }
   },
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "5cfaa383-128a-4393-b089-316eed4a001b",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-10-30T10:37:49.301126Z",
     "iopub.status.busy": "2024-10-30T10:37:49.300742Z",
     "iopub.status.idle": "2024-10-30T10:37:49.310559Z",
     "shell.execute_reply": "2024-10-30T10:37:49.310021Z",
     "shell.execute_reply.started": "2024-10-30T10:37:49.301112Z"
    }
   },
   "outputs": [],
   "source": [
    "daten = pd.read_excel('https://data.hsbo.de/hundesteuer.xls')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "4fabcae8-438a-42f5-aa55-4b314a85c370",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-10-30T10:37:49.691305Z",
     "iopub.status.busy": "2024-10-30T10:37:49.691009Z",
     "iopub.status.idle": "2024-10-30T10:37:49.698576Z",
     "shell.execute_reply": "2024-10-30T10:37:49.698046Z",
     "shell.execute_reply.started": "2024-10-30T10:37:49.691280Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Steuernummer</th>\n",
       "      <th>Normalhunde</th>\n",
       "      <th>Kampfhunde</th>\n",
       "      <th>Preis</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1234</td>\n",
       "      <td>3</td>\n",
       "      <td>5</td>\n",
       "      <td>2880</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1235</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>720</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1236</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>120</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Steuernummer  Normalhunde  Kampfhunde  Preis\n",
       "0          1234            3           5   2880\n",
       "1          1235            4           0    720\n",
       "2          1236            1           0    120"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "daten"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "28329f7e-19ca-4070-9122-baca05bd6db1",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-10-30T10:29:49.189523Z",
     "iopub.status.busy": "2024-10-30T10:29:49.189176Z",
     "iopub.status.idle": "2024-10-30T10:29:49.194365Z",
     "shell.execute_reply": "2024-10-30T10:29:49.193622Z",
     "shell.execute_reply.started": "2024-10-30T10:29:49.189492Z"
    }
   },
   "outputs": [],
   "source": [
    "def steuersatz(anzahlHunde):\n",
    "    if anzahlHunde == 1:\n",
    "        return 120\n",
    "    elif anzahlHunde == 2 or anzahlHunde == 3:\n",
    "        return 150\n",
    "    else:\n",
    "        return 180"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "716850bd-8bb8-4b7a-b713-c17b73064e32",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-10-30T10:30:03.486939Z",
     "iopub.status.busy": "2024-10-30T10:30:03.486178Z",
     "iopub.status.idle": "2024-10-30T10:30:03.491685Z",
     "shell.execute_reply": "2024-10-30T10:30:03.490997Z",
     "shell.execute_reply.started": "2024-10-30T10:30:03.486906Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "180"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "steuersatz(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "f5ac44d7-724b-4374-afed-b9ed31f8debf",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-10-30T10:34:05.165818Z",
     "iopub.status.busy": "2024-10-30T10:34:05.165479Z",
     "iopub.status.idle": "2024-10-30T10:34:05.170201Z",
     "shell.execute_reply": "2024-10-30T10:34:05.169430Z",
     "shell.execute_reply.started": "2024-10-30T10:34:05.165790Z"
    }
   },
   "outputs": [],
   "source": [
    "def faktor(anzahlNormalHunde, anzahlKampfHunde):\n",
    "    if anzahlKampfHunde > anzahlNormalHunde:\n",
    "        return 2\n",
    "    return 1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "bb376379-7712-4190-b4dd-a2e8ba8ac8a0",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-10-30T10:34:22.881615Z",
     "iopub.status.busy": "2024-10-30T10:34:22.881270Z",
     "iopub.status.idle": "2024-10-30T10:34:22.887098Z",
     "shell.execute_reply": "2024-10-30T10:34:22.886370Z",
     "shell.execute_reply.started": "2024-10-30T10:34:22.881587Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "faktor(2, 0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "5dbb1093-27f4-4afa-b3f6-bdf6774c1e9a",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-10-30T10:34:26.780238Z",
     "iopub.status.busy": "2024-10-30T10:34:26.779901Z",
     "iopub.status.idle": "2024-10-30T10:34:26.786038Z",
     "shell.execute_reply": "2024-10-30T10:34:26.785162Z",
     "shell.execute_reply.started": "2024-10-30T10:34:26.780210Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "faktor(2, 3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "148ffb02-aeea-41a7-aa0f-ce425d0b52fb",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-10-30T10:37:41.766878Z",
     "iopub.status.busy": "2024-10-30T10:37:41.766488Z",
     "iopub.status.idle": "2024-10-30T10:37:41.771583Z",
     "shell.execute_reply": "2024-10-30T10:37:41.770693Z",
     "shell.execute_reply.started": "2024-10-30T10:37:41.766851Z"
    }
   },
   "outputs": [],
   "source": [
    "def hundesteuer(anzahlNormal, anzahlKampf):\n",
    "    anzahl = anzahlNormal + anzahlKampf\n",
    "    return anzahl * steuersatz(anzahl) * faktor(anzahlNormal, anzahlKampf)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "231b2ec0-576f-43d5-8fdb-de1de4aee430",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-10-30T10:38:00.570465Z",
     "iopub.status.busy": "2024-10-30T10:38:00.570106Z",
     "iopub.status.idle": "2024-10-30T10:38:00.576099Z",
     "shell.execute_reply": "2024-10-30T10:38:00.575381Z",
     "shell.execute_reply.started": "2024-10-30T10:38:00.570437Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2880"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "hundesteuer(3, 5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8fd9f9d4-dd60-4750-99bc-9138b7a658bf",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "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.11.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
