Skip to content

Weitere Aufgabe für Übung Variablen #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 51 additions & 2 deletions book/content/Exercises/02_python/03_variablen/variablen.ipynb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"tags": [
Expand All @@ -24,27 +25,71 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"# Variablen"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"Variablen sind Platzhalter für Werte und ermöglichen eine flexible Implementierung von Programmen. In dieser Aufgabe werden die ersten Schritte im Umgang mit Variablen geübt."
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Aufgabenteil A"
"## Aufgabenteil A\n",
"Erstellen Sie zwei Variablen und weisen sie ihnen einen Wert zu. Lassen Sie die Werte ausgeben und tauschen Sie danach die Werte der Variablen. Geben Sie erneut die Werte aus."
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"### Lösungsvorschlag"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": [
"loesung",
"hide-cell"
]
},
"outputs": [],
"source": [
"a = 7\n",
"b = 3\n",
"\n",
"print(\"Der Wert von a ist\", a, \"und der Wert von b ist\", b)\n",
"\n",
"temp = a\n",
"a = b\n",
"b = temp\n",
"\n",
"print(\"Der Wert von a ist\", a, \"und der Wert von b ist\", b)"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Aufgabenteil B"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -58,6 +103,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"tags": [
Expand Down Expand Up @@ -118,13 +164,15 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Aufgabenteil B"
"## Aufgabenteil C"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -146,6 +194,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"tags": [
Expand Down