Read-only angepasst

main
Alexander Kimmig 2025-10-06 20:13:15 +00:00
parent 3ef75b271f
commit 3fb9790905
7 changed files with 190 additions and 325 deletions

View File

@ -26,7 +26,9 @@
}, },
"source": [ "source": [
"## Grundlegendes\n", "## Grundlegendes\n",
"Eine Funktion ist ein Block von Anweisungen, der beliebig oft ausgeführt werden kann." "Eine Funktion ist ein Block von Anweisungen, der beliebig oft ausgeführt werden kann.\n",
"\n",
"*Anmerkung: in Java gibt es formal keine \"Funktionen\" sondern ausschließlich \"Methoden\". Von der Anwendung sind diese jedoch - zumindest jetzt am Anfang - identisch.*"
] ]
}, },
{ {

View File

@ -2,7 +2,7 @@
"cells": [ "cells": [
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": null,
"id": "4fbccfbc-2e07-4214-a665-4b13afb2723e", "id": "4fbccfbc-2e07-4214-a665-4b13afb2723e",
"metadata": { "metadata": {
"editable": false, "editable": false,
@ -33,7 +33,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2, "execution_count": null,
"id": "90e1aef5-ac02-45a6-9f98-3c812ed506f0", "id": "90e1aef5-ac02-45a6-9f98-3c812ed506f0",
"metadata": { "metadata": {
"editable": true, "editable": true,
@ -47,13 +47,11 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 3, "execution_count": null,
"id": "a6e2ef7a-6785-44b4-be55-55ef733320bd", "id": "a6e2ef7a-6785-44b4-be55-55ef733320bd",
"metadata": { "metadata": {
"collapsed": true,
"editable": false, "editable": false,
"jupyter": { "jupyter": {
"outputs_hidden": true,
"source_hidden": true "source_hidden": true
}, },
"slideshow": { "slideshow": {
@ -61,27 +59,7 @@
}, },
"tags": [] "tags": []
}, },
"outputs": [ "outputs": [],
{
"name": "stdout",
"output_type": "stream",
"text": [
"01.02.1: hallo ... \u001b[0m\u001b[31mFAILED\u001b[0m \u001b[0m\u001b[38;5;245m(0ms)\u001b[0m\n",
"\n",
"\u001b[0m\u001b[1m\u001b[37m\u001b[41m ERRORS \u001b[0m\n",
"\n",
"01.02.1: hallo \u001b[0m\u001b[38;5;245m=> <anonymous>:1:27\u001b[0m\n",
"\u001b[0m\u001b[1m\u001b[31merror\u001b[0m: ReferenceError: hallo is not defined\n",
" at \u001b[0m\u001b[36m<anonymous>\u001b[0m:\u001b[0m\u001b[33m2\u001b[0m:\u001b[0m\u001b[33m3\u001b[0m\n",
"\n",
"\u001b[0m\u001b[1m\u001b[37m\u001b[41m FAILURES \u001b[0m\n",
"\n",
"01.02.1: hallo \u001b[0m\u001b[38;5;245m=> <anonymous>:1:27\u001b[0m\n",
"\n",
"\u001b[0m\u001b[31mFAILED\u001b[0m | 0 passed | 1 failed \u001b[0m\u001b[38;5;245m(0ms)\u001b[0m\n"
]
}
],
"source": [ "source": [
"Deno.test(\"01.02.1: hallo\", () => {\n", "Deno.test(\"01.02.1: hallo\", () => {\n",
" assertEquals(typeof hallo, 'function')\n", " assertEquals(typeof hallo, 'function')\n",
@ -122,13 +100,11 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4, "execution_count": null,
"id": "f084bd1d-cd11-49f7-a0aa-ee33fd7886d3", "id": "f084bd1d-cd11-49f7-a0aa-ee33fd7886d3",
"metadata": { "metadata": {
"collapsed": true,
"editable": false, "editable": false,
"jupyter": { "jupyter": {
"outputs_hidden": true,
"source_hidden": true "source_hidden": true
}, },
"slideshow": { "slideshow": {
@ -136,33 +112,7 @@
}, },
"tags": [] "tags": []
}, },
"outputs": [ "outputs": [],
{
"name": "stdout",
"output_type": "stream",
"text": [
"01.02.2: a ... \u001b[0m\u001b[31mFAILED\u001b[0m \u001b[0m\u001b[38;5;245m(0ms)\u001b[0m\n",
"01.02.2: b ... \u001b[0m\u001b[31mFAILED\u001b[0m \u001b[0m\u001b[38;5;245m(0ms)\u001b[0m\n",
"\n",
"\u001b[0m\u001b[1m\u001b[37m\u001b[41m ERRORS \u001b[0m\n",
"\n",
"01.02.2: a \u001b[0m\u001b[38;5;245m=> <anonymous>:1:27\u001b[0m\n",
"\u001b[0m\u001b[1m\u001b[31merror\u001b[0m: ReferenceError: a is not defined\n",
" at \u001b[0m\u001b[36m<anonymous>\u001b[0m:\u001b[0m\u001b[33m2\u001b[0m:\u001b[0m\u001b[33m3\u001b[0m\n",
"\n",
"01.02.2: b \u001b[0m\u001b[38;5;245m=> <anonymous>:4:6\u001b[0m\n",
"\u001b[0m\u001b[1m\u001b[31merror\u001b[0m: ReferenceError: b is not defined\n",
" at \u001b[0m\u001b[36m<anonymous>\u001b[0m:\u001b[0m\u001b[33m5\u001b[0m:\u001b[0m\u001b[33m3\u001b[0m\n",
"\n",
"\u001b[0m\u001b[1m\u001b[37m\u001b[41m FAILURES \u001b[0m\n",
"\n",
"01.02.2: a \u001b[0m\u001b[38;5;245m=> <anonymous>:1:27\u001b[0m\n",
"01.02.2: b \u001b[0m\u001b[38;5;245m=> <anonymous>:4:6\u001b[0m\n",
"\n",
"\u001b[0m\u001b[31mFAILED\u001b[0m | 0 passed | 2 failed \u001b[0m\u001b[38;5;245m(0ms)\u001b[0m\n"
]
}
],
"source": [ "source": [
"Deno.test(\"01.02.2: a\", () => {\n", "Deno.test(\"01.02.2: a\", () => {\n",
" assertEquals(typeof a, 'function')\n", " assertEquals(typeof a, 'function')\n",
@ -210,13 +160,11 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 5, "execution_count": null,
"id": "d013cd3d-eb31-4a4f-a679-990fb77243c7", "id": "d013cd3d-eb31-4a4f-a679-990fb77243c7",
"metadata": { "metadata": {
"collapsed": true,
"editable": false, "editable": false,
"jupyter": { "jupyter": {
"outputs_hidden": true,
"source_hidden": true "source_hidden": true
}, },
"slideshow": { "slideshow": {
@ -224,33 +172,7 @@
}, },
"tags": [] "tags": []
}, },
"outputs": [ "outputs": [],
{
"name": "stdout",
"output_type": "stream",
"text": [
"01.02.3: begruesse ... \u001b[0m\u001b[31mFAILED\u001b[0m \u001b[0m\u001b[38;5;245m(0ms)\u001b[0m\n",
"01.02.3: begruessung ... \u001b[0m\u001b[31mFAILED\u001b[0m \u001b[0m\u001b[38;5;245m(0ms)\u001b[0m\n",
"\n",
"\u001b[0m\u001b[1m\u001b[37m\u001b[41m ERRORS \u001b[0m\n",
"\n",
"01.02.3: begruesse \u001b[0m\u001b[38;5;245m=> <anonymous>:1:27\u001b[0m\n",
"\u001b[0m\u001b[1m\u001b[31merror\u001b[0m: ReferenceError: begruesse is not defined\n",
" at \u001b[0m\u001b[36m<anonymous>\u001b[0m:\u001b[0m\u001b[33m2\u001b[0m:\u001b[0m\u001b[33m3\u001b[0m\n",
"\n",
"01.02.3: begruessung \u001b[0m\u001b[38;5;245m=> <anonymous>:4:6\u001b[0m\n",
"\u001b[0m\u001b[1m\u001b[31merror\u001b[0m: ReferenceError: begruessung is not defined\n",
" at \u001b[0m\u001b[36m<anonymous>\u001b[0m:\u001b[0m\u001b[33m5\u001b[0m:\u001b[0m\u001b[33m16\u001b[0m\n",
"\n",
"\u001b[0m\u001b[1m\u001b[37m\u001b[41m FAILURES \u001b[0m\n",
"\n",
"01.02.3: begruesse \u001b[0m\u001b[38;5;245m=> <anonymous>:1:27\u001b[0m\n",
"01.02.3: begruessung \u001b[0m\u001b[38;5;245m=> <anonymous>:4:6\u001b[0m\n",
"\n",
"\u001b[0m\u001b[31mFAILED\u001b[0m | 0 passed | 2 failed \u001b[0m\u001b[38;5;245m(0ms)\u001b[0m\n"
]
}
],
"source": [ "source": [
"Deno.test(\"01.02.3: begruesse\", () => {\n", "Deno.test(\"01.02.3: begruesse\", () => {\n",
" assertEquals(typeof begruesse, 'function')\n", " assertEquals(typeof begruesse, 'function')\n",

View File

@ -125,20 +125,6 @@
"### Anmerkung\n", "### Anmerkung\n",
"Auch `console.log` ist eine Funktion, die auch mehrere Parameter (unterschiedlichen Typs) entgegennehmen kann und alle Parameterwerte nacheinander ausgibt." "Auch `console.log` ist eine Funktion, die auch mehrere Parameter (unterschiedlichen Typs) entgegennehmen kann und alle Parameterwerte nacheinander ausgibt."
] ]
},
{
"cell_type": "code",
"execution_count": null,
"id": "596221c0-294c-4db6-ba7f-1176fc4c0560",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"outputs": [],
"source": []
} }
], ],
"metadata": { "metadata": {

View File

@ -2,13 +2,10 @@
"cells": [ "cells": [
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": null,
"id": "13e0b4fc-3ea3-4fc8-9293-7d9f58eb82fb", "id": "13e0b4fc-3ea3-4fc8-9293-7d9f58eb82fb",
"metadata": { "metadata": {
"editable": true, "editable": false,
"jupyter": {
"source_hidden": true
},
"slideshow": { "slideshow": {
"slide_type": "" "slide_type": ""
}, },
@ -23,7 +20,7 @@
"cell_type": "markdown", "cell_type": "markdown",
"id": "12998cb3-fe6b-4be9-83de-4d725210c5b1", "id": "12998cb3-fe6b-4be9-83de-4d725210c5b1",
"metadata": { "metadata": {
"editable": true, "editable": false,
"slideshow": { "slideshow": {
"slide_type": "" "slide_type": ""
}, },
@ -50,13 +47,11 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2, "execution_count": null,
"id": "288a67d3-1aab-4f24-ac41-ab24c2d098eb", "id": "288a67d3-1aab-4f24-ac41-ab24c2d098eb",
"metadata": { "metadata": {
"collapsed": true, "editable": false,
"editable": true,
"jupyter": { "jupyter": {
"outputs_hidden": true,
"source_hidden": true "source_hidden": true
}, },
"slideshow": { "slideshow": {
@ -64,57 +59,7 @@
}, },
"tags": [] "tags": []
}, },
"outputs": [ "outputs": [],
{
"name": "stdout",
"output_type": "stream",
"text": [
"01.02.4: echo ... \u001b[0m\u001b[31mFAILED\u001b[0m \u001b[0m\u001b[38;5;245m(2ms)\u001b[0m\n",
"01.02.4: Parameter ... \u001b[0m\u001b[31mFAILED\u001b[0m \u001b[0m\u001b[38;5;245m(0ms)\u001b[0m\n",
"01.02.4: Greta ... \u001b[0m\u001b[31mFAILED\u001b[0m \u001b[0m\u001b[38;5;245m(0ms)\u001b[0m\n",
"01.02.4: CO2 ... \u001b[0m\u001b[31mFAILED\u001b[0m \u001b[0m\u001b[38;5;245m(0ms)\u001b[0m\n",
"\n",
"\u001b[0m\u001b[1m\u001b[37m\u001b[41m ERRORS \u001b[0m\n",
"\n",
"01.02.4: echo \u001b[0m\u001b[38;5;245m=> <anonymous>:1:27\u001b[0m\n",
"\u001b[0m\u001b[1m\u001b[31merror\u001b[0m: AssertionError: Values are not equal.\n",
"\n",
"\n",
" \u001b[90m\u001b[1m[Diff]\u001b[22m\u001b[39m \u001b[31m\u001b[1mActual\u001b[22m\u001b[39m / \u001b[32m\u001b[1mExpected\u001b[22m\u001b[39m\n",
"\n",
"\n",
"\u001b[31m\u001b[1m- \u001b[41m\u001b[37mundefined\u001b[31m\u001b[49m\n",
"\u001b[22m\u001b[39m\u001b[32m\u001b[1m+ \u001b[42m\u001b[37mfunction\u001b[32m\u001b[49m\n",
"\u001b[22m\u001b[39m\n",
"\n",
" throw new AssertionError(message);\n",
"\u001b[0m\u001b[31m ^\u001b[0m\n",
" at \u001b[0m\u001b[1m\u001b[3massertEquals\u001b[0m (\u001b[0m\u001b[36mhttps://jsr.io/@std/assert/1.0.13/equals.ts\u001b[0m:\u001b[0m\u001b[33m64\u001b[0m:\u001b[0m\u001b[33m9\u001b[0m)\n",
" at \u001b[0m\u001b[36m<anonymous>\u001b[0m:\u001b[0m\u001b[33m2\u001b[0m:\u001b[0m\u001b[33m3\u001b[0m\n",
"\n",
"01.02.4: Parameter \u001b[0m\u001b[38;5;245m=> <anonymous>:4:6\u001b[0m\n",
"\u001b[0m\u001b[1m\u001b[31merror\u001b[0m: ReferenceError: echo is not defined\n",
" at \u001b[0m\u001b[36m<anonymous>\u001b[0m:\u001b[0m\u001b[33m5\u001b[0m:\u001b[0m\u001b[33m16\u001b[0m\n",
"\n",
"01.02.4: Greta \u001b[0m\u001b[38;5;245m=> <anonymous>:7:6\u001b[0m\n",
"\u001b[0m\u001b[1m\u001b[31merror\u001b[0m: ReferenceError: echo is not defined\n",
" at \u001b[0m\u001b[36m<anonymous>\u001b[0m:\u001b[0m\u001b[33m8\u001b[0m:\u001b[0m\u001b[33m3\u001b[0m\n",
"\n",
"01.02.4: CO2 \u001b[0m\u001b[38;5;245m=> <anonymous>:10:6\u001b[0m\n",
"\u001b[0m\u001b[1m\u001b[31merror\u001b[0m: ReferenceError: echo is not defined\n",
" at \u001b[0m\u001b[36m<anonymous>\u001b[0m:\u001b[0m\u001b[33m11\u001b[0m:\u001b[0m\u001b[33m3\u001b[0m\n",
"\n",
"\u001b[0m\u001b[1m\u001b[37m\u001b[41m FAILURES \u001b[0m\n",
"\n",
"01.02.4: echo \u001b[0m\u001b[38;5;245m=> <anonymous>:1:27\u001b[0m\n",
"01.02.4: Parameter \u001b[0m\u001b[38;5;245m=> <anonymous>:4:6\u001b[0m\n",
"01.02.4: Greta \u001b[0m\u001b[38;5;245m=> <anonymous>:7:6\u001b[0m\n",
"01.02.4: CO2 \u001b[0m\u001b[38;5;245m=> <anonymous>:10:6\u001b[0m\n",
"\n",
"\u001b[0m\u001b[31mFAILED\u001b[0m | 0 passed | 4 failed \u001b[0m\u001b[38;5;245m(3ms)\u001b[0m\n"
]
}
],
"source": [ "source": [
"Deno.test(\"01.02.4: echo\", () => {\n", "Deno.test(\"01.02.4: echo\", () => {\n",
" assertEquals(typeof echo, 'function')\n", " assertEquals(typeof echo, 'function')\n",
@ -134,7 +79,7 @@
"cell_type": "markdown", "cell_type": "markdown",
"id": "f80f8e2f-f8e0-48d4-9ffb-21a17b14b473", "id": "f80f8e2f-f8e0-48d4-9ffb-21a17b14b473",
"metadata": { "metadata": {
"editable": true, "editable": false,
"slideshow": { "slideshow": {
"slide_type": "" "slide_type": ""
}, },
@ -163,10 +108,10 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 3, "execution_count": null,
"id": "21b1f649-6e1f-4c1a-a8f3-f3653dd4eb89", "id": "21b1f649-6e1f-4c1a-a8f3-f3653dd4eb89",
"metadata": { "metadata": {
"editable": true, "editable": false,
"jupyter": { "jupyter": {
"source_hidden": true "source_hidden": true
}, },
@ -175,63 +120,7 @@
}, },
"tags": [] "tags": []
}, },
"outputs": [ "outputs": [],
{
"name": "stdout",
"output_type": "stream",
"text": [
"01.02.5: welcome ... \u001b[0m\u001b[31mFAILED\u001b[0m \u001b[0m\u001b[38;5;245m(0ms)\u001b[0m\n",
"01.02.5: Parameter ... \u001b[0m\u001b[31mFAILED\u001b[0m \u001b[0m\u001b[38;5;245m(0ms)\u001b[0m\n",
"01.02.5: Ada ... \u001b[0m\u001b[31mFAILED\u001b[0m \u001b[0m\u001b[38;5;245m(0ms)\u001b[0m\n",
"01.02.5: Marianne ... \u001b[0m\u001b[31mFAILED\u001b[0m \u001b[0m\u001b[38;5;245m(16ms)\u001b[0m\n",
"01.02.5: Mitchell ... \u001b[0m\u001b[31mFAILED\u001b[0m \u001b[0m\u001b[38;5;245m(0ms)\u001b[0m\n",
"\n",
"\u001b[0m\u001b[1m\u001b[37m\u001b[41m ERRORS \u001b[0m\n",
"\n",
"01.02.5: welcome \u001b[0m\u001b[38;5;245m=> <anonymous>:1:27\u001b[0m\n",
"\u001b[0m\u001b[1m\u001b[31merror\u001b[0m: AssertionError: Values are not equal.\n",
"\n",
"\n",
" \u001b[90m\u001b[1m[Diff]\u001b[22m\u001b[39m \u001b[31m\u001b[1mActual\u001b[22m\u001b[39m / \u001b[32m\u001b[1mExpected\u001b[22m\u001b[39m\n",
"\n",
"\n",
"\u001b[31m\u001b[1m- \u001b[41m\u001b[37mundefined\u001b[31m\u001b[49m\n",
"\u001b[22m\u001b[39m\u001b[32m\u001b[1m+ \u001b[42m\u001b[37mfunction\u001b[32m\u001b[49m\n",
"\u001b[22m\u001b[39m\n",
"\n",
" throw new AssertionError(message);\n",
"\u001b[0m\u001b[31m ^\u001b[0m\n",
" at \u001b[0m\u001b[1m\u001b[3massertEquals\u001b[0m (\u001b[0m\u001b[36mhttps://jsr.io/@std/assert/1.0.13/equals.ts\u001b[0m:\u001b[0m\u001b[33m64\u001b[0m:\u001b[0m\u001b[33m9\u001b[0m)\n",
" at \u001b[0m\u001b[36m<anonymous>\u001b[0m:\u001b[0m\u001b[33m2\u001b[0m:\u001b[0m\u001b[33m3\u001b[0m\n",
"\n",
"01.02.5: Parameter \u001b[0m\u001b[38;5;245m=> <anonymous>:4:6\u001b[0m\n",
"\u001b[0m\u001b[1m\u001b[31merror\u001b[0m: ReferenceError: welcome is not defined\n",
" at \u001b[0m\u001b[36m<anonymous>\u001b[0m:\u001b[0m\u001b[33m5\u001b[0m:\u001b[0m\u001b[33m16\u001b[0m\n",
"\n",
"01.02.5: Ada \u001b[0m\u001b[38;5;245m=> <anonymous>:7:6\u001b[0m\n",
"\u001b[0m\u001b[1m\u001b[31merror\u001b[0m: ReferenceError: welcome is not defined\n",
" at \u001b[0m\u001b[36m<anonymous>\u001b[0m:\u001b[0m\u001b[33m8\u001b[0m:\u001b[0m\u001b[33m3\u001b[0m\n",
"\n",
"01.02.5: Marianne \u001b[0m\u001b[38;5;245m=> <anonymous>:10:6\u001b[0m\n",
"\u001b[0m\u001b[1m\u001b[31merror\u001b[0m: ReferenceError: welcome is not defined\n",
" at \u001b[0m\u001b[36m<anonymous>\u001b[0m:\u001b[0m\u001b[33m11\u001b[0m:\u001b[0m\u001b[33m3\u001b[0m\n",
"\n",
"01.02.5: Mitchell \u001b[0m\u001b[38;5;245m=> <anonymous>:13:6\u001b[0m\n",
"\u001b[0m\u001b[1m\u001b[31merror\u001b[0m: ReferenceError: welcome is not defined\n",
" at \u001b[0m\u001b[36m<anonymous>\u001b[0m:\u001b[0m\u001b[33m14\u001b[0m:\u001b[0m\u001b[33m3\u001b[0m\n",
"\n",
"\u001b[0m\u001b[1m\u001b[37m\u001b[41m FAILURES \u001b[0m\n",
"\n",
"01.02.5: welcome \u001b[0m\u001b[38;5;245m=> <anonymous>:1:27\u001b[0m\n",
"01.02.5: Parameter \u001b[0m\u001b[38;5;245m=> <anonymous>:4:6\u001b[0m\n",
"01.02.5: Ada \u001b[0m\u001b[38;5;245m=> <anonymous>:7:6\u001b[0m\n",
"01.02.5: Marianne \u001b[0m\u001b[38;5;245m=> <anonymous>:10:6\u001b[0m\n",
"01.02.5: Mitchell \u001b[0m\u001b[38;5;245m=> <anonymous>:13:6\u001b[0m\n",
"\n",
"\u001b[0m\u001b[31mFAILED\u001b[0m | 0 passed | 5 failed \u001b[0m\u001b[38;5;245m(18ms)\u001b[0m\n"
]
}
],
"source": [ "source": [
"Deno.test(\"01.02.5: welcome\", () => {\n", "Deno.test(\"01.02.5: welcome\", () => {\n",
" assertEquals(typeof welcome, 'function')\n", " assertEquals(typeof welcome, 'function')\n",

View File

@ -2,7 +2,7 @@
"cells": [ "cells": [
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": null,
"id": "0a476912-ee13-42d8-b705-b711433d149a", "id": "0a476912-ee13-42d8-b705-b711433d149a",
"metadata": { "metadata": {
"editable": false, "editable": false,
@ -37,7 +37,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2, "execution_count": null,
"id": "9a0582d4-9acb-4dd1-86c5-3b9d4d2bd4fb", "id": "9a0582d4-9acb-4dd1-86c5-3b9d4d2bd4fb",
"metadata": { "metadata": {
"editable": true, "editable": true,
@ -51,13 +51,11 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": null,
"id": "b0deac5e-d859-47d0-a220-80d4cdcb98d4", "id": "b0deac5e-d859-47d0-a220-80d4cdcb98d4",
"metadata": { "metadata": {
"collapsed": true,
"editable": false, "editable": false,
"jupyter": { "jupyter": {
"outputs_hidden": true,
"source_hidden": true "source_hidden": true
}, },
"slideshow": { "slideshow": {
@ -65,51 +63,7 @@
}, },
"tags": [] "tags": []
}, },
"outputs": [ "outputs": [],
{
"name": "stdout",
"output_type": "stream",
"text": [
"01.03.1: function ... \u001b[0m\u001b[31mFAILED\u001b[0m \u001b[0m\u001b[38;5;245m(0ms)\u001b[0m\n",
"01.03.1: nand(1,1) ... \u001b[0m\u001b[31mFAILED\u001b[0m \u001b[0m\u001b[38;5;245m(0ms)\u001b[0m\n",
"01.03.1: nand(1,0) ... \u001b[0m\u001b[31mFAILED\u001b[0m \u001b[0m\u001b[38;5;245m(0ms)\u001b[0m\n",
"01.03.1: nand(0,1) ... \u001b[0m\u001b[31mFAILED\u001b[0m \u001b[0m\u001b[38;5;245m(0ms)\u001b[0m\n",
"01.03.1: nand(0,0) ... \u001b[0m\u001b[31mFAILED\u001b[0m \u001b[0m\u001b[38;5;245m(0ms)\u001b[0m\n",
"\n",
"\u001b[0m\u001b[1m\u001b[37m\u001b[41m ERRORS \u001b[0m\n",
"\n",
"01.03.1: function \u001b[0m\u001b[38;5;245m=> <anonymous>:1:27\u001b[0m\n",
"\u001b[0m\u001b[1m\u001b[31merror\u001b[0m: ReferenceError: assertEquals is not defined\n",
" at \u001b[0m\u001b[36m<anonymous>\u001b[0m:\u001b[0m\u001b[33m2\u001b[0m:\u001b[0m\u001b[33m3\u001b[0m\n",
"\n",
"01.03.1: nand(1,1) \u001b[0m\u001b[38;5;245m=> <anonymous>:4:6\u001b[0m\n",
"\u001b[0m\u001b[1m\u001b[31merror\u001b[0m: ReferenceError: assertEquals is not defined\n",
" at \u001b[0m\u001b[36m<anonymous>\u001b[0m:\u001b[0m\u001b[33m5\u001b[0m:\u001b[0m\u001b[33m3\u001b[0m\n",
"\n",
"01.03.1: nand(1,0) \u001b[0m\u001b[38;5;245m=> <anonymous>:7:6\u001b[0m\n",
"\u001b[0m\u001b[1m\u001b[31merror\u001b[0m: ReferenceError: assertEquals is not defined\n",
" at \u001b[0m\u001b[36m<anonymous>\u001b[0m:\u001b[0m\u001b[33m8\u001b[0m:\u001b[0m\u001b[33m3\u001b[0m\n",
"\n",
"01.03.1: nand(0,1) \u001b[0m\u001b[38;5;245m=> <anonymous>:10:6\u001b[0m\n",
"\u001b[0m\u001b[1m\u001b[31merror\u001b[0m: ReferenceError: assertEquals is not defined\n",
" at \u001b[0m\u001b[36m<anonymous>\u001b[0m:\u001b[0m\u001b[33m11\u001b[0m:\u001b[0m\u001b[33m3\u001b[0m\n",
"\n",
"01.03.1: nand(0,0) \u001b[0m\u001b[38;5;245m=> <anonymous>:13:6\u001b[0m\n",
"\u001b[0m\u001b[1m\u001b[31merror\u001b[0m: ReferenceError: assertEquals is not defined\n",
" at \u001b[0m\u001b[36m<anonymous>\u001b[0m:\u001b[0m\u001b[33m14\u001b[0m:\u001b[0m\u001b[33m3\u001b[0m\n",
"\n",
"\u001b[0m\u001b[1m\u001b[37m\u001b[41m FAILURES \u001b[0m\n",
"\n",
"01.03.1: function \u001b[0m\u001b[38;5;245m=> <anonymous>:1:27\u001b[0m\n",
"01.03.1: nand(1,1) \u001b[0m\u001b[38;5;245m=> <anonymous>:4:6\u001b[0m\n",
"01.03.1: nand(1,0) \u001b[0m\u001b[38;5;245m=> <anonymous>:7:6\u001b[0m\n",
"01.03.1: nand(0,1) \u001b[0m\u001b[38;5;245m=> <anonymous>:10:6\u001b[0m\n",
"01.03.1: nand(0,0) \u001b[0m\u001b[38;5;245m=> <anonymous>:13:6\u001b[0m\n",
"\n",
"\u001b[0m\u001b[31mFAILED\u001b[0m | 0 passed | 5 failed \u001b[0m\u001b[38;5;245m(1ms)\u001b[0m\n"
]
}
],
"source": [ "source": [
"Deno.test(\"01.03.1: function\", () => {\n", "Deno.test(\"01.03.1: function\", () => {\n",
" assertEquals(typeof nand, 'function')\n", " assertEquals(typeof nand, 'function')\n",
@ -163,13 +117,11 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2, "execution_count": null,
"id": "82ff9541-bb28-4520-9c93-57185f3ea9bf", "id": "82ff9541-bb28-4520-9c93-57185f3ea9bf",
"metadata": { "metadata": {
"collapsed": true,
"editable": false, "editable": false,
"jupyter": { "jupyter": {
"outputs_hidden": true,
"source_hidden": true "source_hidden": true
}, },
"slideshow": { "slideshow": {
@ -177,51 +129,7 @@
}, },
"tags": [] "tags": []
}, },
"outputs": [ "outputs": [],
{
"name": "stdout",
"output_type": "stream",
"text": [
"01.03.2: function ... \u001b[0m\u001b[31mFAILED\u001b[0m \u001b[0m\u001b[38;5;245m(0ms)\u001b[0m\n",
"01.03.2: nor(1,1) ... \u001b[0m\u001b[31mFAILED\u001b[0m \u001b[0m\u001b[38;5;245m(0ms)\u001b[0m\n",
"01.03.2: nor(1,0) ... \u001b[0m\u001b[31mFAILED\u001b[0m \u001b[0m\u001b[38;5;245m(0ms)\u001b[0m\n",
"01.03.2: nor(0,1) ... \u001b[0m\u001b[31mFAILED\u001b[0m \u001b[0m\u001b[38;5;245m(0ms)\u001b[0m\n",
"01.03.2: nor(0,0) ... \u001b[0m\u001b[31mFAILED\u001b[0m \u001b[0m\u001b[38;5;245m(0ms)\u001b[0m\n",
"\n",
"\u001b[0m\u001b[1m\u001b[37m\u001b[41m ERRORS \u001b[0m\n",
"\n",
"01.03.2: function \u001b[0m\u001b[38;5;245m=> <anonymous>:1:27\u001b[0m\n",
"\u001b[0m\u001b[1m\u001b[31merror\u001b[0m: ReferenceError: assertEquals is not defined\n",
" at \u001b[0m\u001b[36m<anonymous>\u001b[0m:\u001b[0m\u001b[33m2\u001b[0m:\u001b[0m\u001b[33m3\u001b[0m\n",
"\n",
"01.03.2: nor(1,1) \u001b[0m\u001b[38;5;245m=> <anonymous>:4:6\u001b[0m\n",
"\u001b[0m\u001b[1m\u001b[31merror\u001b[0m: ReferenceError: assertEquals is not defined\n",
" at \u001b[0m\u001b[36m<anonymous>\u001b[0m:\u001b[0m\u001b[33m5\u001b[0m:\u001b[0m\u001b[33m3\u001b[0m\n",
"\n",
"01.03.2: nor(1,0) \u001b[0m\u001b[38;5;245m=> <anonymous>:7:6\u001b[0m\n",
"\u001b[0m\u001b[1m\u001b[31merror\u001b[0m: ReferenceError: assertEquals is not defined\n",
" at \u001b[0m\u001b[36m<anonymous>\u001b[0m:\u001b[0m\u001b[33m8\u001b[0m:\u001b[0m\u001b[33m3\u001b[0m\n",
"\n",
"01.03.2: nor(0,1) \u001b[0m\u001b[38;5;245m=> <anonymous>:10:6\u001b[0m\n",
"\u001b[0m\u001b[1m\u001b[31merror\u001b[0m: ReferenceError: assertEquals is not defined\n",
" at \u001b[0m\u001b[36m<anonymous>\u001b[0m:\u001b[0m\u001b[33m11\u001b[0m:\u001b[0m\u001b[33m3\u001b[0m\n",
"\n",
"01.03.2: nor(0,0) \u001b[0m\u001b[38;5;245m=> <anonymous>:13:6\u001b[0m\n",
"\u001b[0m\u001b[1m\u001b[31merror\u001b[0m: ReferenceError: assertEquals is not defined\n",
" at \u001b[0m\u001b[36m<anonymous>\u001b[0m:\u001b[0m\u001b[33m14\u001b[0m:\u001b[0m\u001b[33m3\u001b[0m\n",
"\n",
"\u001b[0m\u001b[1m\u001b[37m\u001b[41m FAILURES \u001b[0m\n",
"\n",
"01.03.2: function \u001b[0m\u001b[38;5;245m=> <anonymous>:1:27\u001b[0m\n",
"01.03.2: nor(1,1) \u001b[0m\u001b[38;5;245m=> <anonymous>:4:6\u001b[0m\n",
"01.03.2: nor(1,0) \u001b[0m\u001b[38;5;245m=> <anonymous>:7:6\u001b[0m\n",
"01.03.2: nor(0,1) \u001b[0m\u001b[38;5;245m=> <anonymous>:10:6\u001b[0m\n",
"01.03.2: nor(0,0) \u001b[0m\u001b[38;5;245m=> <anonymous>:13:6\u001b[0m\n",
"\n",
"\u001b[0m\u001b[31mFAILED\u001b[0m | 0 passed | 5 failed \u001b[0m\u001b[38;5;245m(1ms)\u001b[0m\n"
]
}
],
"source": [ "source": [
"Deno.test(\"01.03.2: function\", () => {\n", "Deno.test(\"01.03.2: function\", () => {\n",
" assertEquals(typeof nor, 'function')\n", " assertEquals(typeof nor, 'function')\n",
@ -279,6 +187,9 @@
"id": "d76d78ff-6a02-42d4-93bc-eb9e19be39ce", "id": "d76d78ff-6a02-42d4-93bc-eb9e19be39ce",
"metadata": { "metadata": {
"editable": false, "editable": false,
"jupyter": {
"source_hidden": true
},
"slideshow": { "slideshow": {
"slide_type": "" "slide_type": ""
}, },
@ -307,7 +218,7 @@
"cell_type": "markdown", "cell_type": "markdown",
"id": "e15e95e4-89e5-4cea-be8f-d95ea68eb9a7", "id": "e15e95e4-89e5-4cea-be8f-d95ea68eb9a7",
"metadata": { "metadata": {
"editable": true, "editable": false,
"slideshow": { "slideshow": {
"slide_type": "" "slide_type": ""
}, },
@ -341,6 +252,10 @@
"execution_count": null, "execution_count": null,
"id": "1af5c359-2df3-49af-82a2-0d6cc8324746", "id": "1af5c359-2df3-49af-82a2-0d6cc8324746",
"metadata": { "metadata": {
"editable": false,
"jupyter": {
"source_hidden": true
},
"slideshow": { "slideshow": {
"slide_type": "" "slide_type": ""
}, },

View File

@ -56,7 +56,7 @@
"cell_type": "markdown", "cell_type": "markdown",
"id": "9d07e555-9477-4459-8f64-bb34293070a9", "id": "9d07e555-9477-4459-8f64-bb34293070a9",
"metadata": { "metadata": {
"editable": true, "editable": false,
"slideshow": { "slideshow": {
"slide_type": "" "slide_type": ""
}, },
@ -81,6 +81,7 @@
"execution_count": 2, "execution_count": 2,
"id": "c7476e8b-1781-4d8a-8c10-5b58feb3b5a3", "id": "c7476e8b-1781-4d8a-8c10-5b58feb3b5a3",
"metadata": { "metadata": {
"editable": false,
"slideshow": { "slideshow": {
"slide_type": "" "slide_type": ""
}, },

View File

@ -5,7 +5,7 @@
"execution_count": null, "execution_count": null,
"id": "a474ad60-bfa2-4e43-9d97-88c553bfdc53", "id": "a474ad60-bfa2-4e43-9d97-88c553bfdc53",
"metadata": { "metadata": {
"editable": true, "editable": false,
"slideshow": { "slideshow": {
"slide_type": "" "slide_type": ""
}, },
@ -20,7 +20,7 @@
"cell_type": "markdown", "cell_type": "markdown",
"id": "a36a9ffd-a123-434a-9148-b8c7c75c30d4", "id": "a36a9ffd-a123-434a-9148-b8c7c75c30d4",
"metadata": { "metadata": {
"editable": true, "editable": false,
"slideshow": { "slideshow": {
"slide_type": "" "slide_type": ""
}, },
@ -87,10 +87,44 @@
"})\n" "})\n"
] ]
}, },
{
"cell_type": "markdown",
"id": "dfe85401-6a4a-4da0-b9f9-bb0ea368698a",
"metadata": {
"editable": false,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"# Mathematischer Hintergrund: Modulo-Rechnung\n",
"Die Modulo-Rechnung kennt ihr bereits aus der Grundschule! Dort rechnet man die Division nur mit ganzen Zahlen, so gilt beispielsweise: **17 geteilt durch 5 ergibt 3 Rest 2**.\n",
"\n",
"Genau das ist in der Informatik die Modulo-Rechnung - sie ergibt genau den Rest einer ganzzahligen Division und wird mit einem `%` geschrieben. Somit gilt: `17 % 5 = 2`.\n",
"\n",
"Das kann man beispielweise nutzen, um Teilbarkeiten herauszufinden. So ist eine Zahl `z` genau dann durch `t` teilbar, wenn `z % t === 0` ergibt."
]
},
{
"cell_type": "markdown",
"id": "616cfd74-357f-457f-81a4-a94d7c71582b",
"metadata": {
"editable": false,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"# Aufgabe 01.03.6\n",
"Programmiere eine Funktion `teilbarDurch7`, die einen ganzzahligen Parameter übernimmt und als Ergebnis einen `boolean`-Wert zurückgibt, der `true` ist, wenn eine durch 7 teilbare Zahl übergeben wurde und andernfalls `false`."
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "58f0c4ee-8ef3-4682-8dd7-53a24afb85a6", "id": "de0fe960-c7e1-40b0-8ee8-f0cb91964889",
"metadata": { "metadata": {
"editable": true, "editable": true,
"slideshow": { "slideshow": {
@ -100,6 +134,122 @@
}, },
"outputs": [], "outputs": [],
"source": [] "source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "4737d8de-51a5-4d5e-afc1-5d5a29700e00",
"metadata": {
"editable": false,
"jupyter": {
"source_hidden": true
},
"slideshow": {
"slide_type": ""
},
"tags": []
},
"outputs": [],
"source": [
"Deno.test(\"01.03.6: function\", () => {\n",
" assertEquals(typeof teilbarDurch7, 'function')\n",
"})\n",
"Deno.test(\"01.03.6: Parameter\", () => {\n",
" assertEquals(teilbarDurch7.length, 1)\n",
"})\n",
"Deno.test(\"01.03.6: teilbarDurch7(0)\", () => {\n",
" assertEquals(teilbarDurch7(0), true)\n",
"})\n",
"Deno.test(\"01.03.6: teilbarDurch7(5)\", () => {\n",
" assertEquals(teilbarDurch7(5), false)\n",
"})\n",
"Deno.test(\"01.03.6: teilbarDurch7(7)\", () => {\n",
" assertEquals(teilbarDurch7(7), true)\n",
"})\n",
"Deno.test(\"01.03.6: teilbarDurch7(49)\", () => {\n",
" assertEquals(teilbarDurch7(49), true)\n",
"})\n",
"Deno.test(\"01.03.6: teilbarDurch7(71)\", () => {\n",
" assertEquals(teilbarDurch7(71), false)\n",
"})\n",
"Deno.test(\"01.03.6: teilbarDurch7(230580)\", () => {\n",
" assertEquals(teilbarDurch7(230580), true)\n",
"})\n"
]
},
{
"cell_type": "markdown",
"id": "340e8acf-97ee-4267-b92b-88d77ed15da0",
"metadata": {
"editable": false,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"# Aufgabe 01.03.7\n",
"Programmiere eine Funktion `istSchaltjahr`, die eine Jahreszahl als Parameter übernimmt und zurückgibt, ob dieses angegebene Jahr ein Schaltjahr ist.\n",
"\n",
"## Hinweis\n",
"Ein Jahr ist genau dann ein Schaltjahr, wenn die Jahreszahl...\n",
"* durch 4 teilbar ist...\n",
"* *außer* wenn sie durch 100 teilbar ist...\n",
"* *außer wiederum* wenn sie durch 400 teilbar ist."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3d5a41a2-5f48-4375-aaae-a466a625598c",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "f8335a26-0e7a-477a-9b68-804e8161bfc7",
"metadata": {
"editable": false,
"jupyter": {
"source_hidden": true
},
"slideshow": {
"slide_type": ""
},
"tags": []
},
"outputs": [],
"source": [
"Deno.test(\"01.03.7: function\", () => {\n",
" assertEquals(typeof istSchaltjahr, 'function')\n",
"})\n",
"Deno.test(\"01.03.7: Parameter\", () => {\n",
" assertEquals(istSchaltjahr.length, 1)\n",
"})\n",
"Deno.test(\"01.03.7: istSchaltjahr(0)\", () => {\n",
" assertEquals(istSchaltjahr(0), true)\n",
"})\n",
"Deno.test(\"01.03.7: istSchaltjahr(2024)\", () => {\n",
" assertEquals(istSchaltjahr(2024), true)\n",
"})\n",
"Deno.test(\"01.03.7: istSchaltjahr(2025)\", () => {\n",
" assertEquals(istSchaltjahr(2025), false)\n",
"})\n",
"Deno.test(\"01.03.7: istSchaltjahr(1900)\", () => {\n",
" assertEquals(istSchaltjahr(1900), false)\n",
"})\n",
"Deno.test(\"01.03.7: istSchaltjahr(0)\", () => {\n",
" assertEquals(istSchaltjahr(2000), true)\n",
"})"
]
} }
], ],
"metadata": { "metadata": {