klitzekleine Überarbeitung

This commit is contained in:
2025-12-04 18:55:47 +00:00
parent 7c9b64d429
commit 91ccae348b

View File

@@ -6,48 +6,6 @@
"id": "c74a7a8e-6e0a-4f42-a18f-46b1aa7fddb1", "id": "c74a7a8e-6e0a-4f42-a18f-46b1aa7fddb1",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Zahl\n"
]
},
{
"name": "stdin",
"output_type": "stream",
"text": [
" \n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Zahl\n"
]
},
{
"name": "stdin",
"output_type": "stream",
"text": [
" \n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Zahl\n"
]
},
{
"name": "stdin",
"output_type": "stream",
"text": [
" \n"
]
},
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
@@ -68,7 +26,25 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"Zahl\n" "Kopf (2x)\n",
"\n",
"Du hast 6.5 Coins (+ 1.0)\n"
]
},
{
"name": "stdin",
"output_type": "stream",
"text": [
" \n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Kopf (3x)\n",
"\n",
"Du hast 8.0 Coins (+ 1.5)\n"
] ]
}, },
{ {
@@ -112,7 +88,37 @@
"text": [ "text": [
"Kopf (1x)\n", "Kopf (1x)\n",
"\n", "\n",
"Du hast 6.0 Coins (+ 0.5)\n" "Du hast 8.5 Coins (+ 0.5)\n"
]
},
{
"name": "stdin",
"output_type": "stream",
"text": [
" \n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Zahl\n"
]
},
{
"name": "stdin",
"output_type": "stream",
"text": [
" \n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Kopf (1x)\n",
"\n",
"Du hast 9.0 Coins (+ 0.5)\n"
] ]
}, },
{ {
@@ -128,7 +134,23 @@
"text": [ "text": [
"Kopf (2x)\n", "Kopf (2x)\n",
"\n", "\n",
"Du hast 7.0 Coins (+ 1.0)\n" "Du hast 10.0 Coins (+ 1.0)\n"
]
},
{
"name": "stdin",
"output_type": "stream",
"text": [
" \n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Kopf (3x)\n",
"\n",
"Du hast 11.5 Coins (+ 1.5)\n"
] ]
}, },
{ {
@@ -154,15 +176,16 @@
"coins_per_head = 0.5\n", "coins_per_head = 0.5\n",
"coins = 5\n", "coins = 5\n",
"coins_amount = 1\n", "coins_amount = 1\n",
"multiplier = 0.5\n",
"\n", "\n",
"def coin_flip(propability, coins, coins_per_head, coins_amount):\n", "def coin_flip(propability, coins, coins_per_head, coins_amount, multiplier):\n",
" while True:\n", " while True:\n",
" result = random.randint(0, 100)\n", " result = random.randint(0, 100)\n",
" if result in range(0,propability):\n", " if result in range(0,propability):\n",
" print(f'Kopf ({coins_amount}x)') \n", " print(f'Kopf ({coins_amount}x)') \n",
" coins_amount += 1 #Anzahl an hintereinander geworfenen \"Köpfen\"\n", " coins_amount += 1 #Anzahl an hintereinander geworfenen \"Köpfen\"\n",
" if coins_amount >=3:\n", " if coins_amount >=3:\n",
" coins_per_head += 0.5 #Coin-Boost für mehrfaches werfen von Kopf hintereinander\n", " coins_per_head += multiplier #Coin-Boost für mehrfaches werfen von Kopf hintereinander\n",
" else:\n", " else:\n",
" coins_per_head = 0.5\n", " coins_per_head = 0.5\n",
" coins += coins_per_head\n", " coins += coins_per_head\n",
@@ -175,7 +198,7 @@
" input()\n", " input()\n",
"\n", "\n",
"\n", "\n",
"coin_flip(propability, coins, coins_per_head, coins_amount)\n" "coin_flip(propability, coins, coins_per_head, coins_amount, multiplier)\n"
] ]
}, },
{ {