diff --git a/lab-python-flow-control.ipynb b/lab-python-flow-control.ipynb index 7905339..e2c6c69 100644 --- a/lab-python-flow-control.ipynb +++ b/lab-python-flow-control.ipynb @@ -10,6 +10,14 @@ "# Lab | Flow Control" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "43612741", + "metadata": {}, + "outputs": [], + "source": [] + }, { "cell_type": "markdown", "id": "303cceb0-f898-4c5f-99bd-c04e131e1ded", @@ -77,7 +85,17 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, + "id": "bf38f17c", + "metadata": {}, + "outputs": [], + "source": [ + "armamento ={'cuchillo', 'espada', 'pistola', 'escudo', 'guantes', 'linterna'}" + ] + }, + { + "cell_type": "code", + "execution_count": 5, "id": "499552c8-9e30-46e1-a706-4ac5dc64670e", "metadata": {}, "outputs": [], @@ -98,15 +116,40 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, + "id": "80911431", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "You encounter a ghost!\n" + ] + } + ], + "source": [ + "resultado = encounter_ghost()" + ] + }, + { + "cell_type": "code", + "execution_count": 1, "id": "d3e4076b-48cc-41ac-95ad-891743e775f5", "metadata": {}, - "outputs": [], + "outputs": [ + { + "ename": "IndentationError", + "evalue": "unindent does not match any outer indentation level (, line 4)", + "output_type": "error", + "traceback": [ + " \u001b[36mFile \u001b[39m\u001b[32m:4\u001b[39m\n\u001b[31m \u001b[39m\u001b[31m\"\"\"\u001b[39m\n ^\n\u001b[31mIndentationError\u001b[39m\u001b[31m:\u001b[39m unindent does not match any outer indentation level\n" + ] + } + ], "source": [ "# main function for the game\n", - "def run_mansion():\n", - " \n", - " print(\"Welcome to the Haunted Mansion!\")\n", + " print(\"Welcome to the Haunted Mansion!\")\n", " \n", " \"\"\"\n", " Simulates an adventure through a haunted mansion. The adventurer starts with 10 health points and no items.\n", @@ -133,6 +176,71 @@ " # your code goes here" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "e81a4ce8", + "metadata": {}, + "outputs": [ + { + "ename": "IndentationError", + "evalue": "expected an indented block after 'if' statement on line 29 (2179817458.py, line 33)", + "output_type": "error", + "traceback": [ + " \u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[2]\u001b[39m\u001b[32m, line 33\u001b[39m\n\u001b[31m \u001b[39m\u001b[31melif camino.upper() == 'right':\u001b[39m\n ^\n\u001b[31mIndentationError\u001b[39m\u001b[31m:\u001b[39m expected an indented block after 'if' statement on line 29\n" + ] + } + ], + "source": [ + "def run_mansion():\n", + "\n", + " vida = 10\n", + "\n", + " armamento ={'cuchillo', 'espada', 'pistola', 'escudo', 'guantes', 'linterna'}\n", + " \n", + " batalla = range(1,11)\n", + "\n", + " camino = random.choice([\"pocion\", \"trampa\"])\n", + "\n", + " if camino == \"pocion\":\n", + "\n", + " armas.append(\"pocion\")\n", + "\n", + " else:\n", + "\n", + " vida = vida -2\n", + "\n", + " print(\"Has caĆ­do en una trampa, tu vida es\", vida)\n", + "\n", + " \n", + "\n", + "#INTRODUCIR RIGHT OR LEFT Y UN BUCLE COMPROBANDO QUE LO QUE ESCRIBIMOS SEA LEFT OR RIGHT Y NO OTRA COSA\n", + " \n", + " camino = input (\"Que camino quieres tomar? Left or Right?\")\n", + " \n", + " while camino.upper() != 'left'.upper() and camino.upper() != 'right'.upper():\n", + "\n", + " camino = input(\"Prueba otra vez. Left or Right?\")\n", + "\n", + " if camino.upper() == 'left'.upper():\n", + " \n", + " ##algo tiene que ocurrir\n", + " \n", + " elif camino.upper() == 'right'.upper():\n", + "\n", + " # funcion encounter_ghost()\n", + " #resultado\n", + " ##escoge right por lo tanto otra cosa tiene que ocurrir\n", + " \n", + "\n", + "\n", + "#BUCLE PARA QUE COMPRUEBE QUE LA VIDA ES MAYOR A 0\n", + "\n", + "while health > 0\n", + "\n", + " " + ] + }, { "cell_type": "markdown", "id": "9e13a33c-38e5-44b3-bd1b-9a642c962c89", @@ -146,7 +254,15 @@ "execution_count": null, "id": "f238dc90-0be2-4d8c-93e9-30a1dc8a5b72", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Welcome to the Haunted Mansion!\n" + ] + } + ], "source": [ "run_mansion()" ] @@ -162,7 +278,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "cpython-3.14.7-windows-x86_64-none (3.14.7)", "language": "python", "name": "python3" }, @@ -176,7 +292,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.14.7" } }, "nbformat": 4,