diff --git a/PythonIntroductionLML.ipynb b/PythonIntroductionLML.ipynb index 8c33f62..b3c51a7 100644 --- a/PythonIntroductionLML.ipynb +++ b/PythonIntroductionLML.ipynb @@ -269,6 +269,22 @@ " print(str(x)+\" es un cubo perfecto\")" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Python tiene una estructura for-else que ayuda para estos casos :)\n", + "x=64\n", + "for ans in range(0,x):\n", + " if ans**3 == x:\n", + " print(str(x)+\" es un cubo perfecto\")\n", + " break\n", + "else:\n", + " print(str(x)+\" no es un cubo perfecto\")" + ] + }, { "cell_type": "code", "execution_count": null, @@ -723,7 +739,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.5" + "version": "3.6.7" } }, "nbformat": 4,