From b043f6677819fb8f728e44a71f82d2ef5d5f9234 Mon Sep 17 00:00:00 2001 From: eliomartinezcastano-stack Date: Tue, 13 Jan 2026 18:01:47 +0100 Subject: [PATCH] algunos cambios --- lab-python-flow-control.ipynb | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lab-python-flow-control.ipynb b/lab-python-flow-control.ipynb index 7905339..575bd3f 100644 --- a/lab-python-flow-control.ipynb +++ b/lab-python-flow-control.ipynb @@ -77,12 +77,13 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "id": "499552c8-9e30-46e1-a706-4ac5dc64670e", "metadata": {}, "outputs": [], "source": [ "def encounter_ghost():\n", + " import random\n", " \"\"\"\n", " This function handles the encounter with a ghost. \n", " The outcome of the battle is determined by a random number between 1 and 10.\n", @@ -92,8 +93,13 @@ " and return something that indicates the ghost defeated the adventurer.\n", " \"\"\"\n", " print(\"You encounter a ghost!\")\n", - " \n", - " # your code goes here" + " outcome = random.randint(1, 10)\n", + " if outcome <= 5:\n", + " print(\"You defeated the ghost!\")\n", + " return True\n", + " else:\n", + " print(\"You lost the battle...\")\n", + " return False" ] }, { @@ -162,7 +168,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "base", "language": "python", "name": "python3" }, @@ -176,7 +182,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.13.9" } }, "nbformat": 4,