delete checkpoints

This commit is contained in:
Cornelius Specht 2024-09-27 09:08:26 +02:00
parent fd84f76b3c
commit 2bea3aa589
13 changed files with 0 additions and 6303 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,854 +0,0 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "f3557a6d-106e-461c-bc75-7ddcef4f81e5",
"metadata": {},
"outputs": [],
"source": [
"import numpy as np"
]
},
{
"cell_type": "markdown",
"id": "80a3b70d-fea8-4a6f-ac02-73e30abc1f66",
"metadata": {},
"source": [
"### ufunc\n",
"ufuncs are used to implement vectorization in NumPy which is way faster than iterating over elements.\n",
"\n",
"They also provide broadcasting and additional methods like reduce, accumulate etc. that are very helpful for computation.\n",
"\n",
"ufuncs also take additional arguments, like:\n",
"\n",
"where boolean array or condition defining where the operations should take place.\n",
"\n",
"dtype defining the return type of elements.\n",
"\n",
"out output array where the return value should be copied."
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "60f2d36b-d334-4e19-9f63-36688cca1c20",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[5, 7, 9, 11]\n"
]
}
],
"source": [
"# python\n",
"x = [1, 2, 3, 4]\n",
"y = [4, 5, 6, 7]\n",
"z = []\n",
"\n",
"for i, j in zip(x, y):\n",
" z.append(i + j)\n",
"print(z)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "0272feaa-47e7-44b4-a66d-dafdffca4a7b",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[ 5 7 9 11]\n"
]
}
],
"source": [
"# numpy\n",
"x = [1, 2, 3, 4]\n",
"y = [4, 5, 6, 7]\n",
"z = np.add(x, y)\n",
"\n",
"print(z)"
]
},
{
"cell_type": "markdown",
"id": "5e52ad13-9186-4866-b1c7-3f8a16901c9f",
"metadata": {},
"source": [
"#### Own function"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "3d004fc9-f52c-42fb-93a1-f48dd0849ba9",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[6 8 10 12]\n"
]
}
],
"source": [
"def myadd(x, y):\n",
" return x+y\n",
"\n",
"myadd = np.frompyfunc(myadd, 2, 1)\n",
"\n",
"print(myadd([1, 2, 3, 4], [5, 6, 7, 8]))"
]
},
{
"cell_type": "markdown",
"id": "c034cd44-af9c-44ff-8d74-cf0d8d34b018",
"metadata": {},
"source": [
"#### Simple Arithmetic"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "428246a1-ea45-4c0b-bc94-b3f1ad27a0ac",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[30 32 34 36 38 40]\n"
]
}
],
"source": [
"arr1 = np.array([10, 11, 12, 13, 14, 15])\n",
"arr2 = np.array([20, 21, 22, 23, 24, 25])\n",
"\n",
"newarr = np.add(arr1, arr2)\n",
"\n",
"print(newarr)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "ae349412-0d47-42b4-8c39-56d0839b3d34",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[-10 -1 8 17 26 35]\n"
]
}
],
"source": [
"arr1 = np.array([10, 20, 30, 40, 50, 60])\n",
"arr2 = np.array([20, 21, 22, 23, 24, 25])\n",
"\n",
"newarr = np.subtract(arr1, arr2)\n",
"\n",
"print(newarr)"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "f61b2129-e31b-4661-a12e-d7897955d163",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[ 200 420 660 920 1200 1500]\n"
]
}
],
"source": [
"arr1 = np.array([10, 20, 30, 40, 50, 60])\n",
"arr2 = np.array([20, 21, 22, 23, 24, 25])\n",
"\n",
"newarr = np.multiply(arr1, arr2)\n",
"\n",
"print(newarr)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "67540798-c33e-4d1e-a1d9-47c00a121b36",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[ 3.33333333 4. 3. 5. 25. 1.81818182]\n"
]
}
],
"source": [
"arr1 = np.array([10, 20, 30, 40, 50, 60])\n",
"arr2 = np.array([3, 5, 10, 8, 2, 33])\n",
"\n",
"newarr = np.divide(arr1, arr2)\n",
"\n",
"print(newarr)"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "05c10eef-8c8e-4515-9aea-402821f05a02",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[ 1000 3200000 729000000 6553600000000 2500\n",
" 0]\n"
]
}
],
"source": [
"arr1 = np.array([10, 20, 30, 40, 50, 60])\n",
"arr2 = np.array([3, 5, 6, 8, 2, 33])\n",
"\n",
"newarr = np.power(arr1, arr2)\n",
"\n",
"print(newarr)"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "c47b12e8-f0a0-45c9-b1e5-202fd2dfdaed",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[ 1 6 3 0 0 27]\n"
]
}
],
"source": [
"arr1 = np.array([10, 20, 30, 40, 50, 60])\n",
"arr2 = np.array([3, 7, 9, 8, 2, 33])\n",
"\n",
"newarr = np.mod(arr1, arr2)\n",
"\n",
"print(newarr)"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "7626b9ec-04f0-421b-a35d-8f30bad5a136",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(array([ 3, 2, 3, 5, 25, 1]), array([ 1, 6, 3, 0, 0, 27]))\n"
]
}
],
"source": [
"# Quotient and Mod\n",
"arr1 = np.array([10, 20, 30, 40, 50, 60])\n",
"arr2 = np.array([3, 7, 9, 8, 2, 33])\n",
"\n",
"newarr = np.divmod(arr1, arr2)\n",
"\n",
"print(newarr)"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "e436c31a-a796-4be1-9e7f-ddaf0f026dec",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[1 2 1 2 3 4]\n"
]
}
],
"source": [
"arr = np.array([-1, -2, 1, 2, 3, -4])\n",
"\n",
"newarr = np.absolute(arr)\n",
"\n",
"print(newarr)"
]
},
{
"cell_type": "markdown",
"id": "d55a17c4-1f67-4629-8a85-64f9faa32370",
"metadata": {},
"source": [
"### Rounding Decimals\n",
"- truncation\n",
"- fix\n",
"- rounding\n",
"- floor\n",
"- ceil"
]
},
{
"cell_type": "code",
"execution_count": 18,
"id": "11395b0f-660b-4c28-a2ed-1c722b560a71",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[-3. 3.]\n"
]
}
],
"source": [
"# Truncation\n",
"# Remove the decimals, and return the float number closest to zero. Use the trunc() and fix() functions.\n",
"\n",
"arr = np.trunc([-3.1666, 3.6667])\n",
"\n",
"print(arr)"
]
},
{
"cell_type": "code",
"execution_count": 17,
"id": "9d2c024e-07ca-43cd-978b-206a391e35f1",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[-3. 3.]\n"
]
}
],
"source": [
"arr = np.fix([-3.1666, 3.6667])\n",
"\n",
"print(arr)"
]
},
{
"cell_type": "code",
"execution_count": 19,
"id": "59ca3a99-da45-4a5c-8a2f-bcb6b22a5998",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"3.17\n"
]
}
],
"source": [
"# rounding\n",
"arr = np.around(3.1666, 2)\n",
"\n",
"print(arr)"
]
},
{
"cell_type": "code",
"execution_count": 20,
"id": "e213a874-e4b0-4a3e-831a-5e9ff93c3d94",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[-4. 3.]\n"
]
}
],
"source": [
"arr = np.floor([-3.1666, 3.6667])\n",
"\n",
"print(arr)"
]
},
{
"cell_type": "code",
"execution_count": 21,
"id": "fbe93a72-8e92-4b36-bfab-232c1617e4f1",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[-3. 4.]\n"
]
}
],
"source": [
"arr = np.ceil([-3.1666, 3.6667])\n",
"\n",
"print(arr)"
]
},
{
"cell_type": "markdown",
"id": "225b1cd3-85cf-492d-8f1d-b2c94eb63783",
"metadata": {},
"source": [
"### Logs"
]
},
{
"cell_type": "code",
"execution_count": 24,
"id": "995a441d-e78e-4ace-b6fc-b497cce04268",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[1 2 3 4 5 6 7 8 9]\n",
"[0. 1. 1.5849625 2. 2.32192809 2.5849625\n",
" 2.80735492 3. 3.169925 ]\n"
]
}
],
"source": [
"# log2() function to perform log at the base 2.\n",
"arr = np.arange(1, 10)\n",
"print(arr)\n",
"print(np.log2(arr))\n"
]
},
{
"cell_type": "markdown",
"id": "b386fbe7-54c7-48dd-8b08-10f053e00638",
"metadata": {},
"source": [
"### Summations"
]
},
{
"cell_type": "code",
"execution_count": 26,
"id": "16f39361-d8a9-4d9a-970e-72367f2d4685",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[2 4 6]\n"
]
}
],
"source": [
"arr1 = np.array([1, 2, 3])\n",
"arr2 = np.array([1, 2, 3])\n",
"\n",
"newarr = np.add(arr1, arr2)\n",
"\n",
"print(newarr)"
]
},
{
"cell_type": "code",
"execution_count": 27,
"id": "bd241f37-75bf-4ee5-bcb4-8c72695eb75d",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"12\n"
]
}
],
"source": [
"arr1 = np.array([1, 2, 3])\n",
"arr2 = np.array([1, 2, 3])\n",
"\n",
"newarr = np.sum([arr1, arr2])\n",
"\n",
"print(newarr)"
]
},
{
"cell_type": "code",
"execution_count": 29,
"id": "7309e9d4-c239-4c42-8389-413df30d6abc",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[6 6]\n"
]
}
],
"source": [
"# summation over axis\n",
"arr1 = np.array([1, 2, 3])\n",
"arr2 = np.array([1, 2, 3])\n",
"\n",
"newarr = np.sum([arr1, arr2], axis=1)\n",
"\n",
"print(newarr)"
]
},
{
"cell_type": "markdown",
"id": "518cdbe0-417b-4085-9575-729595ae2a52",
"metadata": {},
"source": [
"### Products"
]
},
{
"cell_type": "code",
"execution_count": 31,
"id": "0211ead9-2b18-4409-a4c6-179688bdd203",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"24\n"
]
}
],
"source": [
"arr = np.array([1, 2, 3, 4])\n",
"\n",
"x = np.prod(arr)\n",
"\n",
"print(x)"
]
},
{
"cell_type": "markdown",
"id": "207af559-db09-48f5-b462-40fd52500bb4",
"metadata": {},
"source": [
"### Differences"
]
},
{
"cell_type": "code",
"execution_count": 32,
"id": "5215ae9f-709b-4206-90f3-95b5dd391f68",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[ 5 10 -20]\n"
]
}
],
"source": [
"arr = np.array([10, 15, 25, 5])\n",
"\n",
"newarr = np.diff(arr)\n",
"\n",
"print(newarr)"
]
},
{
"cell_type": "code",
"execution_count": 34,
"id": "23aeea8b-3f92-490e-927d-a61a8426a365",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[ 5 -30]\n"
]
}
],
"source": [
"# Compute discrete difference of the following array twice\n",
"# 15-10=5, 25-15=10, and 5-25=-20 AND 10-5=5 and -20-10=-30\n",
"arr = np.array([10, 15, 25, 5])\n",
"\n",
"newarr = np.diff(arr, n=2)\n",
"\n",
"print(newarr)"
]
},
{
"cell_type": "markdown",
"id": "0da9fba4-7ae2-4bfe-94b8-378d3d124b57",
"metadata": {},
"source": [
"#### Other"
]
},
{
"cell_type": "code",
"execution_count": 36,
"id": "69a07fa4-546c-47cd-99b2-a14548b886e2",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"12\n"
]
}
],
"source": [
"# Finding LCM (Lowest Common Multiple)\n",
"num1 = 4\n",
"num2 = 6\n",
"# (4*3=12 and 6*2=12)\n",
"x = np.lcm(num1, num2)\n",
"\n",
"print(x) "
]
},
{
"cell_type": "code",
"execution_count": 37,
"id": "9c874e84-1ca6-44f8-871b-0c57d05ac360",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"18\n"
]
}
],
"source": [
"arr = np.array([3, 6, 9])\n",
"\n",
"x = np.lcm.reduce(arr)\n",
"\n",
"print(x)"
]
},
{
"cell_type": "code",
"execution_count": 38,
"id": "d7f635b8-7915-452b-8ee1-e963ed5e8f54",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"3\n"
]
}
],
"source": [
"# Finding GCD (Greatest Common Denominator)\n",
"num1 = 6\n",
"num2 = 9\n",
"\n",
"x = np.gcd(num1, num2)\n",
"\n",
"print(x)"
]
},
{
"cell_type": "code",
"execution_count": 41,
"id": "d39331bf-062b-41b8-b7fe-082312dd5d6f",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[1 2 3 4 5 6 7]\n"
]
}
],
"source": [
"# unique\n",
"arr = np.array([1, 1, 1, 2, 3, 4, 5, 5, 6, 7])\n",
"\n",
"x = np.unique(arr)\n",
"\n",
"print(x)\n"
]
},
{
"cell_type": "code",
"execution_count": 43,
"id": "126fdebd-0a45-4be7-a65d-b4e119ebef7d",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[1 2 3 4 5 6]\n"
]
}
],
"source": [
"arr1 = np.array([1, 2, 3, 4])\n",
"arr2 = np.array([3, 4, 5, 6])\n",
"\n",
"newarr = np.union1d(arr1, arr2)\n",
"print(newarr)"
]
},
{
"cell_type": "code",
"execution_count": 44,
"id": "a84475b1-15c3-4c8f-8535-2913a4b8579d",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[3 4]\n"
]
}
],
"source": [
"arr1 = np.array([1, 2, 3, 4])\n",
"arr2 = np.array([3, 4, 5, 6])\n",
"\n",
"newarr = np.intersect1d(arr1, arr2, assume_unique=True)\n",
"\n",
"print(newarr)"
]
},
{
"cell_type": "code",
"execution_count": 45,
"id": "771b4dc1-78e9-4819-af4f-b2bb3bc154e5",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[1 2]\n"
]
}
],
"source": [
"set1 = np.array([1, 2, 3, 4])\n",
"set2 = np.array([3, 4, 5, 6])\n",
"\n",
"newarr = np.setdiff1d(set1, set2, assume_unique=True)\n",
"\n",
"print(newarr)"
]
},
{
"cell_type": "code",
"execution_count": 39,
"id": "95b8cec1-8b0e-43fb-acae-428d7778c03e",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1.0\n"
]
}
],
"source": [
"# Trigonometric Functions\n",
"x = np.sin(np.pi/2)\n",
"\n",
"print(x)"
]
},
{
"cell_type": "code",
"execution_count": 40,
"id": "e3dbac10-d7bd-45bb-974b-56f8f6082de8",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[1.57079633 3.14159265 4.71238898 6.28318531]\n"
]
}
],
"source": [
"# and sin(), cos() and tan()\n",
"# np.deg2rad(arr)\n",
"# Hyperbolic: sinh(), cosh() and tanh()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "67cab045-d1ef-4de1-9aaa-5257d5ba5571",
"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.10.8"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

View File

@ -1,631 +0,0 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "bd4b5db9-6439-4519-aef0-c8bb8ffd6a13",
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd"
]
},
{
"cell_type": "markdown",
"id": "a3c4bf54-07f7-46bb-9ae5-77c3a4518627",
"metadata": {},
"source": [
"### Basics"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "def1dfe3-6afe-4f5e-9714-36b65811094a",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" cars passings\n",
"0 BMW 3\n",
"1 Volvo 7\n",
"2 Ford 2\n"
]
}
],
"source": [
"mydataset = {\n",
" 'cars': [\"BMW\", \"Volvo\", \"Ford\"],\n",
" 'passings': [3, 7, 2]\n",
"}\n",
"\n",
"myvar = pd.DataFrame(mydataset)\n",
"\n",
"print(myvar)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "0785d9bd-e5b1-4221-84e9-1a1a6a2cf37e",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0 1\n",
"1 7\n",
"2 2\n",
"dtype: int64\n"
]
}
],
"source": [
"# series: numpy arrays!\n",
"a = [1, 7, 2]\n",
"\n",
"myvar = pd.Series(a)\n",
"\n",
"print(myvar)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "2d7a5f33-79a2-4e2a-9b14-eee43db90662",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"x 1\n",
"y 7\n",
"z 2\n",
"dtype: int64\n"
]
}
],
"source": [
"# labels\n",
"a = [1, 7, 2]\n",
"\n",
"myvar = pd.Series(a, index = [\"x\", \"y\", \"z\"])\n",
"\n",
"print(myvar)"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "cba4f2ef-45d1-4c23-94ce-7197c43d4aee",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"day1 420\n",
"day2 380\n",
"day3 390\n",
"dtype: int64\n"
]
}
],
"source": [
"# key value objects\n",
"calories = {\"day1\": 420, \"day2\": 380, \"day3\": 390}\n",
"\n",
"myvar = pd.Series(calories)\n",
"\n",
"print(myvar)"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "e965971f-6a97-42c4-81bf-2550e57cd7e9",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" calories duration\n",
"0 420 50\n",
"1 380 40\n",
"2 390 45\n"
]
}
],
"source": [
"# dataframe = multi-dimensional tables\n",
"data = {\n",
" \"calories\": [420, 380, 390],\n",
" \"duration\": [50, 40, 45]\n",
"}\n",
"\n",
"df = pd.DataFrame(data)\n",
"\n",
"print(df)"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "a6650272-40db-4237-b2d6-83d3652184c2",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"calories 420\n",
"duration 50\n",
"Name: 0, dtype: int64\n"
]
}
],
"source": [
"# locate row\n",
"print(df.loc[0])"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "694a5a9b-c280-454c-b7c6-236eda33d8f4",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" calories duration\n",
"0 420 50\n",
"1 380 40\n"
]
}
],
"source": [
"#use a list of indexes:\n",
"print(df.loc[[0, 1]])"
]
},
{
"cell_type": "code",
"execution_count": 16,
"id": "e3ff6022-327e-446d-a739-011730d1db8a",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" calories duration\n",
"day1 420 50\n",
"day2 380 40\n",
"day3 390 45\n"
]
}
],
"source": [
"# named index\n",
"data = {\n",
" \"calories\": [420, 380, 390],\n",
" \"duration\": [50, 40, 45]\n",
"}\n",
"\n",
"df = pd.DataFrame(data, index = [\"day1\", \"day2\", \"day3\"])\n",
"\n",
"print(df) "
]
},
{
"cell_type": "code",
"execution_count": 17,
"id": "4d8a50a4-7c1d-4ef7-ab0b-09cbc8085ad6",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"calories 380\n",
"duration 40\n",
"Name: day2, dtype: int64\n"
]
}
],
"source": [
"#refer to the named index:\n",
"print(df.loc[\"day2\"])"
]
},
{
"cell_type": "markdown",
"id": "b18cee34-c5dd-43df-9e2e-bd20ebeed8ed",
"metadata": {},
"source": [
"### Loading Files"
]
},
{
"cell_type": "code",
"execution_count": 19,
"id": "abef3aeb-d82c-4cc5-a2d2-7a70313f0712",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" Duration Pulse Maxpulse Calories\n",
"0 60 110 130 409.1\n",
"1 60 117 145 479.0\n",
"2 60 103 135 340.0\n",
"3 45 109 175 282.4\n",
"4 45 117 148 406.0\n",
"5 60 102 127 300.0\n",
"6 60 110 136 374.0\n",
"7 45 104 134 253.3\n",
"8 30 109 133 195.1\n",
"9 60 98 124 269.0\n",
"10 60 103 147 329.3\n",
"11 60 100 120 250.7\n",
"12 60 106 128 345.3\n",
"13 60 104 132 379.3\n",
"14 60 98 123 275.0\n",
"15 60 98 120 215.2\n",
"16 60 100 120 300.0\n",
"17 45 90 112 NaN\n",
"18 60 103 123 323.0\n",
"19 45 97 125 243.0\n",
"20 60 108 131 364.2\n",
"21 45 100 119 282.0\n",
"22 60 130 101 300.0\n",
"23 45 105 132 246.0\n",
"24 60 102 126 334.5\n",
"25 60 100 120 250.0\n",
"26 60 92 118 241.0\n",
"27 60 103 132 NaN\n",
"28 60 100 132 280.0\n",
"29 60 102 129 380.3\n",
"30 60 92 115 243.0\n",
"31 45 90 112 180.1\n",
"32 60 101 124 299.0\n",
"33 60 93 113 223.0\n",
"34 60 107 136 361.0\n",
"35 60 114 140 415.0\n",
"36 60 102 127 300.0\n",
"37 60 100 120 300.0\n",
"38 60 100 120 300.0\n",
"39 45 104 129 266.0\n",
"40 45 90 112 180.1\n",
"41 60 98 126 286.0\n",
"42 60 100 122 329.4\n",
"43 60 111 138 400.0\n",
"44 60 111 131 397.0\n",
"45 60 99 119 273.0\n",
"46 60 109 153 387.6\n",
"47 45 111 136 300.0\n",
"48 45 108 129 298.0\n",
"49 60 111 139 397.6\n",
"50 60 107 136 380.2\n",
"51 80 123 146 643.1\n",
"52 60 106 130 263.0\n",
"53 60 118 151 486.0\n",
"54 30 136 175 238.0\n",
"55 60 121 146 450.7\n",
"56 60 118 121 413.0\n",
"57 45 115 144 305.0\n",
"58 20 153 172 226.4\n",
"59 45 123 152 321.0\n",
"60 210 108 160 1376.0\n",
"61 160 110 137 1034.4\n",
"62 160 109 135 853.0\n",
"63 45 118 141 341.0\n",
"64 20 110 130 131.4\n",
"65 180 90 130 800.4\n",
"66 150 105 135 873.4\n",
"67 150 107 130 816.0\n",
"68 20 106 136 110.4\n",
"69 300 108 143 1500.2\n",
"70 150 97 129 1115.0\n",
"71 60 109 153 387.6\n",
"72 90 100 127 700.0\n",
"73 150 97 127 953.2\n",
"74 45 114 146 304.0\n",
"75 90 98 125 563.2\n",
"76 45 105 134 251.0\n",
"77 45 110 141 300.0\n",
"78 120 100 130 500.4\n",
"79 270 100 131 1729.0\n",
"80 30 159 182 319.2\n",
"81 45 149 169 344.0\n",
"82 30 103 139 151.1\n",
"83 120 100 130 500.0\n",
"84 45 100 120 225.3\n",
"85 30 151 170 300.0\n",
"86 45 102 136 234.0\n",
"87 120 100 157 1000.1\n",
"88 45 129 103 242.0\n",
"89 20 83 107 50.3\n",
"90 180 101 127 600.1\n",
"91 45 107 137 NaN\n",
"92 30 90 107 105.3\n",
"93 15 80 100 50.5\n",
"94 20 150 171 127.4\n",
"95 20 151 168 229.4\n",
"96 30 95 128 128.2\n",
"97 25 152 168 244.2\n",
"98 30 109 131 188.2\n",
"99 90 93 124 604.1\n",
"100 20 95 112 77.7\n",
"101 90 90 110 500.0\n",
"102 90 90 100 500.0\n",
"103 90 90 100 500.4\n",
"104 30 92 108 92.7\n",
"105 30 93 128 124.0\n",
"106 180 90 120 800.3\n",
"107 30 90 120 86.2\n",
"108 90 90 120 500.3\n",
"109 210 137 184 1860.4\n",
"110 60 102 124 325.2\n",
"111 45 107 124 275.0\n",
"112 15 124 139 124.2\n",
"113 45 100 120 225.3\n",
"114 60 108 131 367.6\n",
"115 60 108 151 351.7\n",
"116 60 116 141 443.0\n",
"117 60 97 122 277.4\n",
"118 60 105 125 NaN\n",
"119 60 103 124 332.7\n",
"120 30 112 137 193.9\n",
"121 45 100 120 100.7\n",
"122 60 119 169 336.7\n",
"123 60 107 127 344.9\n",
"124 60 111 151 368.5\n",
"125 60 98 122 271.0\n",
"126 60 97 124 275.3\n",
"127 60 109 127 382.0\n",
"128 90 99 125 466.4\n",
"129 60 114 151 384.0\n",
"130 60 104 134 342.5\n",
"131 60 107 138 357.5\n",
"132 60 103 133 335.0\n",
"133 60 106 132 327.5\n",
"134 60 103 136 339.0\n",
"135 20 136 156 189.0\n",
"136 45 117 143 317.7\n",
"137 45 115 137 318.0\n",
"138 45 113 138 308.0\n",
"139 20 141 162 222.4\n",
"140 60 108 135 390.0\n",
"141 60 97 127 NaN\n",
"142 45 100 120 250.4\n",
"143 45 122 149 335.4\n",
"144 60 136 170 470.2\n",
"145 45 106 126 270.8\n",
"146 60 107 136 400.0\n",
"147 60 112 146 361.9\n",
"148 30 103 127 185.0\n",
"149 60 110 150 409.4\n",
"150 60 106 134 343.0\n",
"151 60 109 129 353.2\n",
"152 60 109 138 374.0\n",
"153 30 150 167 275.8\n",
"154 60 105 128 328.0\n",
"155 60 111 151 368.5\n",
"156 60 97 131 270.4\n",
"157 60 100 120 270.4\n",
"158 60 114 150 382.8\n",
"159 30 80 120 240.9\n",
"160 30 85 120 250.4\n",
"161 45 90 130 260.4\n",
"162 45 95 130 270.0\n",
"163 45 100 140 280.9\n",
"164 60 105 140 290.8\n",
"165 60 110 145 300.0\n",
"166 60 115 145 310.2\n",
"167 75 120 150 320.4\n",
"168 75 125 150 330.4\n"
]
}
],
"source": [
"#https://www.w3schools.com/python/pandas/data.csv\n",
"df = pd.read_csv('https://www.w3schools.com/python/pandas/data.csv')\n",
"\n",
"print(df.to_string()) "
]
},
{
"cell_type": "markdown",
"id": "1dba1828-de88-4a61-868b-5a8b638254f0",
"metadata": {},
"source": [
"#### Analyze Data"
]
},
{
"cell_type": "code",
"execution_count": 22,
"id": "e89c6f79-b957-4c6b-85bc-c76b362d7a2a",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(169, 4)\n"
]
}
],
"source": [
"print(df.shape)"
]
},
{
"cell_type": "code",
"execution_count": 25,
"id": "460724ee-1ba6-461c-801e-46632a68c837",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<class 'pandas.core.frame.DataFrame'>\n",
"RangeIndex: 169 entries, 0 to 168\n",
"Data columns (total 4 columns):\n",
" # Column Non-Null Count Dtype \n",
"--- ------ -------------- ----- \n",
" 0 Duration 169 non-null int64 \n",
" 1 Pulse 169 non-null int64 \n",
" 2 Maxpulse 169 non-null int64 \n",
" 3 Calories 164 non-null float64\n",
"dtypes: float64(1), int64(3)\n",
"memory usage: 5.4 KB\n",
"None\n"
]
}
],
"source": [
"print(df.info()) "
]
},
{
"cell_type": "code",
"execution_count": 21,
"id": "418bbc3e-53ff-4ea2-9728-1b8aa94a140d",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" Duration Pulse Maxpulse Calories\n",
"0 60 110 130 409.1\n",
"1 60 117 145 479.0\n",
"2 60 103 135 340.0\n",
"3 45 109 175 282.4\n",
"4 45 117 148 406.0\n",
"5 60 102 127 300.0\n",
"6 60 110 136 374.0\n",
"7 45 104 134 253.3\n",
"8 30 109 133 195.1\n",
"9 60 98 124 269.0\n"
]
}
],
"source": [
"print(df.head(10))"
]
},
{
"cell_type": "code",
"execution_count": 23,
"id": "b7424301-9bb4-4200-b2d5-bcc8a22c6427",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" Duration Pulse Maxpulse Calories\n",
"0 60 110 130 409.1\n",
"1 60 117 145 479.0\n",
"2 60 103 135 340.0\n",
"3 45 109 175 282.4\n",
"4 45 117 148 406.0\n"
]
}
],
"source": [
"print(df.head())"
]
},
{
"cell_type": "code",
"execution_count": 24,
"id": "a7649f71-6c14-4158-8040-08019577b1ad",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" Duration Pulse Maxpulse Calories\n",
"164 60 105 140 290.8\n",
"165 60 110 145 300.0\n",
"166 60 115 145 310.2\n",
"167 75 120 150 320.4\n",
"168 75 125 150 330.4\n"
]
}
],
"source": [
"print(df.tail())"
]
},
{
"cell_type": "code",
"execution_count": 29,
"id": "8da3696c-6a3c-4727-8cea-6442d7cedf28",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"count 169.000000\n",
"mean 107.461538\n",
"std 14.510259\n",
"min 80.000000\n",
"25% 100.000000\n",
"50% 105.000000\n",
"75% 111.000000\n",
"max 159.000000\n",
"Name: Pulse, dtype: float64\n"
]
}
],
"source": [
"print(df['Pulse'].describe())"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8689d23c-5d68-4fdb-bcef-9ae080442a27",
"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.10.8"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,32 +0,0 @@
,Duration,Date,Pulse,Maxpulse,Calories
0,60,2020-12-01,110,130,409.1
1,60,2020-12-02,117,145,479.0
2,60,2020-12-03,103,135,340.0
3,45,2020-12-04,109,175,282.4
4,45,2020-12-05,117,148,406.0
5,60,2020-12-06,102,127,300.0
6,60,2020-12-07,110,136,374.0
7,45,2020-12-08,104,134,253.3
8,30,2020-12-09,109,133,195.1
9,60,2020-12-10,98,124,269.0
10,60,2020-12-11,103,147,329.3
11,60,2020-12-12,100,120,250.7
13,60,2020-12-13,106,128,345.3
14,60,2020-12-14,104,132,379.3
15,60,2020-12-15,98,123,275.0
16,60,2020-12-16,98,120,215.2
17,60,2020-12-17,100,120,300.0
18,45,2020-12-18,90,112,304.68
19,60,2020-12-19,103,123,323.0
20,45,2020-12-20,97,125,243.0
21,60,2020-12-21,108,131,364.2
22,45,,100,119,282.0
23,60,2020-12-23,130,101,300.0
24,45,2020-12-24,105,132,246.0
25,60,2020-12-25,102,126,334.5
26,60,2020-12-26,100,120,250.0
27,60,2020-12-27,92,118,241.0
28,60,2020-12-28,103,132,304.68
29,60,2020-12-29,100,132,280.0
30,60,2020-12-30,102,129,380.3
31,60,2020-12-31,92,115,243.0
1 Duration Date Pulse Maxpulse Calories
2 0 60 2020-12-01 110 130 409.1
3 1 60 2020-12-02 117 145 479.0
4 2 60 2020-12-03 103 135 340.0
5 3 45 2020-12-04 109 175 282.4
6 4 45 2020-12-05 117 148 406.0
7 5 60 2020-12-06 102 127 300.0
8 6 60 2020-12-07 110 136 374.0
9 7 45 2020-12-08 104 134 253.3
10 8 30 2020-12-09 109 133 195.1
11 9 60 2020-12-10 98 124 269.0
12 10 60 2020-12-11 103 147 329.3
13 11 60 2020-12-12 100 120 250.7
14 13 60 2020-12-13 106 128 345.3
15 14 60 2020-12-14 104 132 379.3
16 15 60 2020-12-15 98 123 275.0
17 16 60 2020-12-16 98 120 215.2
18 17 60 2020-12-17 100 120 300.0
19 18 45 2020-12-18 90 112 304.68
20 19 60 2020-12-19 103 123 323.0
21 20 45 2020-12-20 97 125 243.0
22 21 60 2020-12-21 108 131 364.2
23 22 45 100 119 282.0
24 23 60 2020-12-23 130 101 300.0
25 24 45 2020-12-24 105 132 246.0
26 25 60 2020-12-25 102 126 334.5
27 26 60 2020-12-26 100 120 250.0
28 27 60 2020-12-27 92 118 241.0
29 28 60 2020-12-28 103 132 304.68
30 29 60 2020-12-29 100 132 280.0
31 30 60 2020-12-30 102 129 380.3
32 31 60 2020-12-31 92 115 243.0

View File

@ -1,202 +0,0 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "2e29ba0a-8c8d-43a7-8c69-91a45dd510f4",
"metadata": {
"tags": []
},
"source": [
"### Python Data-Types "
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "985a7730-4e2f-4dd8-8963-0c05929d6537",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"10\n"
]
}
],
"source": [
"#### Numbers\n",
"some_number = 9\n",
"some_decimal_number = 9.123\n",
"# some math\n",
"result = some_number + 1 \n",
"print(result)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "bc668dd1-2c00-4428-9792-87fc82268066",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"anna schmidt\n"
]
}
],
"source": [
"#### Text (string)\n",
"some_name = \"anna\"\n",
"some_last_name= \"schmidt\"\n",
"# concat\n",
"result = some_name + \" \" + some_last_name\n",
"print(result)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "15f12de7-b59e-47a5-8493-9ce6dc993b1a",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ANNA SCHMIDT\n"
]
}
],
"source": [
"#### Text transformation\n",
"print(result.upper()) # or .lower()"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "ef60122f-ff4e-41ba-81c6-03bd425f4182",
"metadata": {},
"outputs": [],
"source": [
"#### Boolean\n",
"wahr = True # 1\n",
"falsch = False # 0\n"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "5286e63f-d505-4d7f-988d-a4272530edd7",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[10, 20, 30]\n",
"3\n",
"10\n"
]
}
],
"source": [
"#### List\n",
"some_list = [10,20,30]\n",
"print(some_list)\n",
"print(len(some_list)) # length\n",
"print(some_list[0]) # first position starts at 0 !"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "de268e19-56cb-4b15-9eb4-d2d1c206e816",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['some', 'text', 'going', 'here']\n",
"4\n",
"['some', 'text', 'going', 'here', 'abit more']\n",
"5\n"
]
}
],
"source": [
"#### More lists\n",
"some_text_list = [\"some\",\"text\",\"going\",\"here\"]\n",
"print(some_text_list)\n",
"print(len(some_text_list))\n",
"# add something to the list\n",
"some_text_list.append(\"abit more\")\n",
"print(some_text_list)\n",
"print(len(some_text_list))\n"
]
},
{
"cell_type": "markdown",
"id": "f0fe7482-edc7-42b8-9f8d-dd54e8fe67f0",
"metadata": {},
"source": [
"#### check type"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "ec30a547-3e4f-436d-965e-28434dcbb7bb",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<class 'float'>\n",
"<class 'str'>\n",
"<class 'bool'>\n"
]
}
],
"source": [
"print(type(1.0))\n",
"print(type(\"bla\"))\n",
"print(type(wahr))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ee9a0aca-344c-4f1e-adc0-8feaf5fe59ea",
"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.10.8"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

View File

@ -1,177 +0,0 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "fd3ba99f-b630-408c-b8f4-e62e189c6057",
"metadata": {},
"source": [
"### Python Logic Operators"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "58b1616e-9df5-426c-857b-d3017f052b07",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"False\n"
]
}
],
"source": [
"print(1 == 2)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "c87c73b4-414c-49b2-9e8f-fb3ea64f734a",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"True\n"
]
}
],
"source": [
"print(1 != 2)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "c0785e94-8795-4200-8148-50eea688e381",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"False\n"
]
}
],
"source": [
"print(1>2)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "51a3869d-14f4-4f36-89a5-8b274e6867bb",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"False\n"
]
}
],
"source": [
"print(\"1\" == 1)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d77b7f00-7eaf-4812-a2b9-57dc00dfc701",
"metadata": {},
"outputs": [],
"source": [
"### Add multiple condition"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "0c4650aa-71f5-43e1-a027-fd68db0c585e",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"True\n"
]
}
],
"source": [
"print(1 < 10 and 1 > 0)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "97b73046-93fc-4496-bbcc-e4cd83b9e971",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"True\n"
]
}
],
"source": [
"print(1 < 10 or 1 > 10)\n"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "69781d14-9295-42cd-935a-eef3e4e6c1e6",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"True\n"
]
}
],
"source": [
"print(not \"bla\" == \"blup\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e2e24ad8-fec6-4399-aada-f09f6f35b992",
"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.10.8"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

View File

@ -1,97 +0,0 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "3eea86ad-74b7-4d9c-8cac-814d6e9858e9",
"metadata": {},
"source": [
"### Loops"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "8ba4b151-0dcc-4f65-9b0c-1d242fe63d9a",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Axel\n",
"Elke\n",
"Martin\n",
"nach der for-Schleife\n"
]
}
],
"source": [
"vornamen = ['Axel', 'Elke', 'Martin']\n",
"for einzelwert in vornamen:\n",
" print(einzelwert)\n",
"print(\"nach der for-Schleife\")"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "d5d85399-b41a-433f-b6c2-279197a40157",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1\n",
"2\n",
"3\n",
"4\n",
"5\n",
"6\n",
"7\n",
"8\n",
"9\n",
"10\n",
"nach der Schleife\n"
]
}
],
"source": [
"durchgang = 1\n",
"while durchgang < 11:\n",
" print(durchgang)\n",
" durchgang = durchgang + 1\n",
"print(\"nach der Schleife\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "32f0f630-7392-449b-a33b-ee5250752bb6",
"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.10.12"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

View File

@ -1,124 +0,0 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "2aa66773-49ef-43bd-8f86-84a9ea68c4d4",
"metadata": {},
"source": [
"### Functions"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "53eaee4f-539c-4a5e-baf2-1f45077eebb0",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1\n",
"2\n",
"3\n",
"4\n",
"5\n",
"6\n",
"7\n",
"8\n",
"Funktion ausgabe durchlaufen\n"
]
},
{
"data": {
"text/plain": [
"36"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"def ausgabe(endwert, anfangswert=1, schrittweite=1):\n",
" summe = 0\n",
" for x in range(anfangswert, endwert, schrittweite):\n",
" print(x)\n",
" summe = summe + x\n",
" print(\"Funktion ausgabe durchlaufen\")\n",
" return summe\n",
"\n",
"ausgabe(9)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "e9bc89ad-6b67-4109-b6d6-f74218cfe304",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1\n",
"2\n",
"3\n",
"4\n",
"5\n",
"6\n",
"7\n",
"8\n",
"9\n",
"10\n",
"11\n",
"Funktion ausgabe durchlaufen\n"
]
},
{
"data": {
"text/plain": [
"66"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ausgabe(12)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7e207043-c521-48ef-9ee4-b0e6f8ce2164",
"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.10.12"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

View File

@ -1,111 +0,0 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "bcdc32a0-9b80-472b-a7a6-eda570fb8b86",
"metadata": {},
"source": [
"### classes"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "03fc3fad-4c9a-4864-8596-c8e9a383fe4e",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"orange\n"
]
}
],
"source": [
"class BauplanKatzenKlasse():\n",
" \"\"\" Klasse für das Erstellen von Katzen \"\"\"\n",
"\n",
" def __init__(self, rufname, farbe, alter):\n",
" self.rufname = rufname\n",
" self.farbe = farbe\n",
" self.alter = alter\n",
" self.schlafdauer = 0\n",
" \n",
" def miauzen(self,amount=1):\n",
" out = \"mia\"\n",
" for i in range(amount):\n",
" out = out + \"u\"\n",
" print(out)\n",
"\n",
"katze_sammy = BauplanKatzenKlasse(\"Sammy\", \"orange\", 3)\n",
"print(katze_sammy.farbe)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "d259947e-1b01-4826-be6b-11909c32bd80",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"miau\n"
]
}
],
"source": [
"katze_sammy.miauzen()"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "e8a7cff4-b60f-48c8-9c1e-8f209516f992",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"miauuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu\n"
]
}
],
"source": [
"katze_sammy.miauzen(amount=100)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "caef4f55-b746-457f-9a88-a6e4c47a56f6",
"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.10.12"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

View File

@ -1,60 +0,0 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "a3795d4d-7bed-4d3b-995c-0a6c05ad8a7c",
"metadata": {},
"source": [
"### libs"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "4a85fd9b-1e27-4d0b-a323-33a965e37968",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"5.0\n"
]
}
],
"source": [
"import math\n",
"print(math.sqrt(25))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "621adbab-7608-48fc-9bc8-a8203ee5484a",
"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.10.12"
}
},
"nbformat": 4,
"nbformat_minor": 5
}